VBA - Select columns using numbers?

前端 未结 9 2182
北荒
北荒 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-05 08:30

    no need for loops or such.. try this..

    dim startColumnas integer
    
    dim endColumn as integer
    
    startColumn = 7
    
    endColumn = 24
    
    Range(Cells(, startColumn), Cells(, endColumn)).ColumnWidth = 3.8 ' <~~ whatever width you want to set..* 
    

提交回复
热议问题