...doesn't seem to work, but does work if the actual values are hard coded in. Here's what I mean:
Words are within the cell text, i.e., substings, hence asteriks before and after.
So this code just asks Excel to find all occurrences within all cell text down col A that contain
last days or latter days.
I want the input from Userform textboxes like this:
Please help if you see what I'm doing wrong. This should be very easy to accomplish
Thanks, cr
Code:
Private Sub cmdFINDVAL_Click()
Dim val1, val2 As String
val1 = Userform1.TextBox1.Value = last days
val2 =Userform1.TextBox2.Value = latter days
Range("A1:A10").Select
Selection.AUTOFILTER
ActiveSheet.Range("$A$1:$A$10").AUTOFILTER Field:=1, Criteria1:= _
"*val1*", Operator:=xlOr, Criteria2:="*val2*"
End Sub
does not work. However, using the actual value between quotes does work when done like this:
ActiveSheet.Range("$A$1:$A$10").AUTOFILTER Field:=1, Criteria1:= _
"*last days*", Operator:=xlOr, Criteria2:="*latter days*"
So this code just asks Excel to find all occurrences within all cell text down col A that contain
last days or latter days.
I want the input from Userform textboxes like this:
Please help if you see what I'm doing wrong. This should be very easy to accomplish
Thanks, cr