简体   繁体   English

Excel VBA选择列

[英]excel vba selecting columns

I want to select a range of entire excel columns. 我想选择整个Excel列的范围。 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. 这只会减慢您的宏的速度并使它的读取时间更长。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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