|
有点小错误,更正如下:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Target = Range("c2") Then
Dim LastRow, i As Integer
LastRow = Range("a65535").End(xlUp).Row
Debug.Print LastRow
Cells.EntireRow.Hidden = False
For i = 1 To LastRow
Select Case Target.Value
Case Is = 1
If Cells(i + 3, 1).Value <> 1 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 2
If Cells(i + 3, 1).Value <> 2 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 3
If Cells(i + 3, 1).Value <> 3 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 4
If Cells(i + 3, 1).Value <> 4 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 5
If Cells(i + 3, 1).Value <> 5 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 6
If Cells(i + 3, 1).Value <> 6 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 7
If Cells(i + 3, 1).Value <> 7 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
Case Is = 8
If Cells(i + 3, 1).Value <> 8 Then
Cells(i + 3, 1).EntireRow.Hidden = True
End If
End Select
Next
End If
End Sub
|
|