我想在 VBA 的 1 行(如下所示)中隐藏几列(彼此不靠近),但它不起作用。它出什么问题了?
Columns("A, C:D").hidden = True
最佳答案
使用Range.EntireColumn
.
Range("A:A,C:D").EntireColumn.Hidden = True
This thread is similar , 和 this answer证明 Union
也是这里的另一个选择。请注意
.EntireColumn
有必要的;省略它会抛出一个Run-time error '1004':
Unable to set the Hidden property of the Range class.
关于Excel VBA在1行代码中隐藏了几列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67131109/