user366121
user366121

Reputation: 3301

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

Upvotes: 1

Views: 13379

Answers (1)

iDevlop
iDevlop

Reputation: 25272

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.

Upvotes: 5

Related Questions