Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的代码。
Sub Hide_Column() Range("A,C:AV,AY:BA,BJ:BR").Select Selection.EntireColumn.Hidden = True End Sub
我在我的活动工作簿中从我的个人运行这个。想法?
选择列时,不使用行号,必须给出开始和结束。
range("A")是不正确的
range("A")
range("A:A")是正确的格式
range("A:A")
所以你的代码应该是这样的:
range("A:A,C:AV,AY:BA,BJ:BR").Columns.Hidden=true