PDA

View Full Version : Solved: Filter code help



U_Shrestha
03-03-2008, 02:52 PM
Hello all,

I need help with following Code.

Private Sub CommandButton6_Click()
Application.ScreenUpdating = False
Sheets("AuditIssues").Select
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
Selection.AutoFilter Field:=8, Criteria1:="Active"
Selection.AutoFilter Field:=9, Criteria1:="Peter"
Application.ScreenUpdating = True
End Sub

By clicking the button, the sheet named "AuditIssues" should open, unfilter all the table and select "Active" and "Peter" from columns H and I. Can someone please help? Thanks.

U_Shrestha
03-03-2008, 03:00 PM
Actually the folowing worked. Thanks.

Private Sub CommandButton6_Click()
Application.ScreenUpdating = False
Sheets("AuditIssues").Select
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End if
Selection.AutoFilter Field:=8, Criteria1:="Active"
Selection.AutoFilter Field:=9, Criteria1:="Peter"
Application.ScreenUpdating = True
End Sub