VBA Excel 工作表选择更改不起作用

VBA Excel 工作表选择更改不起作用

下面的代码不起作用...为什么?

Private Sub Worksheet_Change(ByVal Target As Range)

     On Error Resume Next
     Application.ScreenUpdating = True
     Application.EnableEvents = True

     If Target.address = "B9" Then
     Select Case Target.Value
        Case "English"
        Rows(6).EntireRow.Hidden = True
        Rows(5).EntireRow.Hidden = False
     Case Else
        Rows(6).EntireRow.Hidden = False
        Rows(5).EntireRow.Hidden = True
     End Select
     End If

End Sub

答案1

代替:

If Target.Address = "B9" Then

和:

If Target.Address = "$B$9" Then

相关内容