VBA - Select columns using numbers?

前端 未结 9 2197
北荒
北荒 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:38

    In this way, you can start to select data even behind column "Z" and select a lot of columns.

    Sub SelectColumNums()
        Dim xCol1 As Integer, xNumOfCols as integer
        xCol1 = 26
        xNumOfCols = 17
        Range(Columns(xCol1), Columns(xCol1 + xNumOfCols)).Select
    End Sub
    

提交回复
热议问题