excel vba 选择列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6369950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:29:40  来源:igfitidea点击:

excel vba selecting columns

excelvbaselect

提问by user366121

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

我想选择整个 excel 列的范围。可以用这个表达式选择它们吗?

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

最好的,美国

回答by Patrick Honorez

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.

顺便说一下,您不需要 Select 来作用于范围。这只会减慢您的宏速度并延长阅读时间。