|
参与一下。。。
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim c1 As Range
- Set c1 = Me.Range("c1")
- If Not Intersect(Target, c1) Is Nothing Then
- Application.ScreenUpdating = False
- Application.EnableEvents = False
- Me.Rows("2:1000").EntireRow.Hidden = False
- Select Case c1.Value
- Case "OK"
- For i = 3 To Me.Cells(Me.Rows.Count, "C").End(xlUp).Row
- If Me.Cells(i, "C").Value = "OK" Then
- Me.Rows(i).Hidden = False
- Else
- Me.Rows(i).Hidden = True
- End If
- Next i
- Case "NO"
- For i = 3 To Me.Cells(Me.Rows.Count, "C").End(xlUp).Row
- If Me.Cells(i, "C").Value = "NO" Then
- Me.Rows(i).Hidden = False
- Else
- Me.Rows(i).Hidden = True
- End If
- Next i
- Case "全部"
- For i = 3 To Me.Cells(Me.Rows.Count, "C").End(xlUp).Row
- Me.Rows(i).Hidden = False
- Next i
- End Select
- Application.ScreenUpdating = True
- Application.EnableEvents = True
- End If
- End Sub
复制代码
|
|