1

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
3
  • and what doesn't work as expected in your current code? Commented Dec 27, 2011 at 12:40
  • similar to stackoverflow.com/q/8532986/78522 Commented Dec 27, 2011 at 12:57
  • @Jmax I had to also tweak the strCriteria code that's one of the reasons it gave an error. Commented Dec 27, 2011 at 15:09

1 Answer 1

2

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...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.