确定范围内给定单元格的显示/隐藏状态
我有一组设置为范围的值,并且想要为每个值运行给定的操作。这可行:
Sub demo()
For Each listitem in Sheets("Sheet").Range("List").Rows
'Do stuff with listitem
Next listitem
End Sub
问题是,我想添加一些额外的功能;如果我隐藏给定的行,我希望它能够识别它而不是处理该行 - 沿着这些思路:
Sub demo()
For Each listitem in Sheets("Sheet").Range("List").Rows
If listitem.Visible Then
'Do stuff with listitem
End If
Next listitem
End Sub
不幸的是,当我时,我不断收到 Object does not support this property or method
尝试一下。
据推测这是可能的,那么我需要使用什么命令才能让它工作呢?
I have a set of values set up as a range, and want to run a given action for each one of them. This works:
Sub demo()
For Each listitem in Sheets("Sheet").Range("List").Rows
'Do stuff with listitem
Next listitem
End Sub
The issue is, I'd like to add a bit of extra functionality; if I hide a given row, I'd like it to pick up on it and not process that row - something along these lines:
Sub demo()
For Each listitem in Sheets("Sheet").Range("List").Rows
If listitem.Visible Then
'Do stuff with listitem
End If
Next listitem
End Sub
Unfortunately, I keep getting Object does not support this property or method
when I try that.
Presumably this is possible, so what command do I need to use to get it to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为
If listitem.Hidden=False
可以工作。I think
If listitem.Hidden=False
could work.