Human_doing
Board Regular
- Joined
- Feb 16, 2011
- Messages
- 137
Hi all,
Can anyone please help with this code, what I'm looking to do is create a message box that asks user to choose a value and then autofilter returns all rows where the input criterion appears at any point in the cell. The below code only returns rows where the cell exactly matches the criterion. Any help much appreciated,
Thanks
Can anyone please help with this code, what I'm looking to do is create a message box that asks user to choose a value and then autofilter returns all rows where the input criterion appears at any point in the cell. The below code only returns rows where the cell exactly matches the criterion. Any help much appreciated,
Thanks
Code:
Dim MyInput1 As Variant
MyInput1 = InputBox("To which employee are you wishing to address this email? Correctly enter first name and surname, ", _
"Enter Employee name", Format(Text, ""))
MsgBox "Employee selected is " & MyInput1
'Autofilter section
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:= _
">=" & MyInput1, Operator:=xlAnd, Criteria2:="<=" & MyInput1