Reputation: 119
I want to filter a pre-determined column using a query from a user (Input Box)
Ex: Filter column "L" with a user input text "Joey". Can anyone guide me as to what needs to be done? This is the code I was trying...
Set wSheetStart = ActiveSheet
Set rFilterHeads = Range("L1", Range("IV1").End(xlToLeft))
With wSheetStart
.AutoFilterMode = False
rFilterHeads.AutoFilter
strCriteria = InputBox("Enter Criteria")
If strCriteria = vbNullString Then Exit Sub
rFilterHeads.AutoFilter Field:=3, Criteria1:=strCriteria
End With
Upvotes: 1
Views: 3869
Reputation: 25272
Use a loop + Like
to limit entry to whatever you need.
Do
strCriteria = UCase(InputBox("Enter criteria"))
Loop Until Len(strCriteria) = 0 Or strCriteria Like "?????"
If Len(strCriteria) = 0 Then Exit Sub
'continue...
Upvotes: 2