简体   繁体   中英

excel vba selecting columns

I want to select a range of entire excel columns. Is it possible to select them with this expression?

range(cells(rowindex, columnindex),cells(rowindex,columnindex)).Select

So far it didn't really work out. I have to change the format and width for them.

best, US

Range("b2:f5").Columns.ColumnWidth = 5

or

Range(Columns(6), Columns(9)).ColumnWidth = 15

By the way, you don't need to Select for acting on a range. That just slows down your macro and make it longer to read.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM