Hi
Im looking to filter a column based on a code the user puts into an input box.
I know the first part of the code should be ok but the second i have just entered, if anyone can help!
Sub CodeFilter()
Dim oS, cl As Range
oS = Application.InputBox("Please Enter Search Criteria")
If oS = "" Then MsgBox "You must Enter a Code": Exit Sub
If oS = "False" Then Exit Sub
For Each cl In Range
Rows("1:1").Select
Selection.AutoFilter Field:=5, Criteria1:="oS", Operator:=xlAnd
End Sub
Im looking to filter a column based on a code the user puts into an input box.
I know the first part of the code should be ok but the second i have just entered, if anyone can help!
Sub CodeFilter()
Dim oS, cl As Range
oS = Application.InputBox("Please Enter Search Criteria")
If oS = "" Then MsgBox "You must Enter a Code": Exit Sub
If oS = "False" Then Exit Sub
For Each cl In Range
Rows("1:1").Select
Selection.AutoFilter Field:=5, Criteria1:="oS", Operator:=xlAnd
End Sub