如果我在 AE49 或 Z40 中有值但随后将其删除,则以下脚本会显示运行时错误“13”类型不匹配。理想情况下,如果该值被删除,它应该“隐藏”行(这是我试图通过 Case Else 行实现的)。
Private Sub Script2(ByVal Target As Range)
If (Not Intersect(Target, Range("Z40")) Is Nothing) Then
Select Case Target.Value
Case "PowerPoint", "Verbal"
Range("A41").EntireRow.Hidden = False
Case Else
Range("A41").EntireRow.Hidden = True
End Select
End If
End Sub
Private Sub Script3(ByVal Target As Range)
If (Not Intersect(Target, Range("AE49")) Is Nothing) Then
Select Case Target.Value
Case 1
Range("A50:A52").EntireRow.Hidden = False
Range("A53:A55").EntireRow.Hidden = True
Case 2
Range("A50:A53").EntireRow.Hidden = False
Range("A54:A55").EntireRow.Hidden = True
Case 3
Range("A50:A54").EntireRow.Hidden = False
Range("A55").EntireRow.Hidden = True
Case 4
Range("A50:A55").EntireRow.Hidden = False
Case Else
Range("A50:A55").EntireRow.Hidden = True
End Select
End If
End Sub