0

在此处输入图像描述

我试图隐藏错误的行。

目前我有

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Range("B10:B13") = False Then
        Target.EntireRow.Hidden = True
    End If
End Sub
4

2 回答 2

2

尝试遍历范围内的每个单元格并像这样测试它的值

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim c As Range
    For Each c In Range("B9:B13")
        If Not c.Value Then
            c.EntireRow.Hidden = True
        End If
    Next c
End Sub

编辑:我认为另一种实现结果的方法是从图表中删除系列

Dim n As Long
With ChartObjects(1).Chart
   For n = .SeriesCollection.Count To 1 Step -1
      With .SeriesCollection(n)
          If .Name = "" Then
              .Delete
          End If
      End With
   Next n
End With
于 2013-06-27T15:17:42.697 回答
2
for i = 9 to 13
if range("B" & i) = "False" then
    Rows(i & ":" & i).EntireRow.Hidden = True
end if
next
于 2013-06-27T15:18:04.777 回答