VBA - Select columns using numbers?

前端 未结 9 2300
北荒
北荒 2021-02-05 08:06

I\'m looking for an alternative to this code, but using numbers. I want to select 5 columns, the start column is a variable, and then it selects 5 columns from this

9条回答
  •  轮回少年
    2021-02-05 08:24

    you can use range with cells to get the effect you want (but it would be better not to use select if you don't have to)

    For n = 1 to 5
    range(cells(1,n).entirecolumn,cells(1,n+4).entirecolumn).Select
    do sth
    next n
    

提交回复
热议问题