确定范围内给定单元格的显示/隐藏状态

时间:2011-04-21 06:57:50

标签: excel excel-vba excel-2003 vba

我将一组值设置为范围,并希望为每个值运行给定的操作。这有效:

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

据推测这是可能的,所以我需要使用什么命令才能让它工作?

1 个答案:

答案 0 :(得分:2)

我认为If listitem.Hidden=False可行。