I have a code below that allows user input to select which sheet and criteria to hide.
Is there a way to allow multiple sheets to filter at once.
i.e. I have cells B1,B2,B3,B4 and B5 with sheets names, if I have B2 and B4 as my active cell (selected cells) and run the macro with criteria, it will filter those sheets?
Is there a way to allow multiple sheets to filter at once.
i.e. I have cells B1,B2,B3,B4 and B5 with sheets names, if I have B2 and B4 as my active cell (selected cells) and run the macro with criteria, it will filter those sheets?
VBA Code:
Sub filter()
Dim noRows As Integer
Dim myRange As String
Dim searchRange As String
Dim criteria_1 As String
Dim mysheet As String
mysheet = Application.InputBox("Enter Sheet Name")
noRows = Worksheets(mysheet).UsedRange.Rows.Count
noRows_cor = noRows + 3
myRange = "A1:A" & noRows_cor
criteria_1 = Application.InputBox("Enter your Criteria:")
Worksheets(mysheet).Range(myRange).AutoFilter Field:=1, Criteria1:="<>" & criteria_1
End Sub