取消隐藏,直到第+1行

问题描述

这是我用来过滤数据和创建多个报告的当前代码。它会在A列(FS)中搜索文本,并停止隐藏行,直到到达空白单元格,然后再次隐藏所有内容,直到到达下一个文本(LR)。

但是,我需要保留该空白行,因为它包含我需要的数据,然后在该行之后开始“隐藏”过程。我是VBA的新手,对您的帮助非常感谢。

Sub RunReport()

Set R = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
hiderow = False
For Each c In R.Cells
    If Left(c.Value,2) = "FS" Then
        hiderow = False
    ElseIf Left(c.Value,2) = "LR" Then
        hiderow = False
    ElseIf Left(c.Value,2) = "SR" Then
        hiderow = False
    ElseIf Left(c.Value,3) = "ROG" Then
        hiderow = False
    ElseIf Left(c.Value,8) = "ST" Then
        hiderow = False
    ElseIf Len(c.Value) = 0 Then
        hiderow = True
    End If
    If hiderow Then
        c.Select
        Selection.EntireRow.Hidden = True
    End If
Next c
End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)