Hello
I've searched all over to and tried everything to get my code to filter a range of cells based on an input into a text box. I want the range to filter on every keystroke in the box and also want there to be a wildcard before and after the text box text. I can get the code to work fine if i remove the "*" before and after the text box data in the Criteria, but i cannot get the wildcard to function. Any help would be appreciated.
Private Sub WidthFilterTextBox_Change()
If WidthFilterTextBox.Value <> "" Then
Sheet2.AutoFilterMode = False
Sheet2.Range("B2:F112").AutoFilter Field:=5, Criteria1:="*" & WidthFilterTextBox.Text & "*"
Else
Sheet2.AutoFilterMode = False
End If
End Sub
I've searched all over to and tried everything to get my code to filter a range of cells based on an input into a text box. I want the range to filter on every keystroke in the box and also want there to be a wildcard before and after the text box text. I can get the code to work fine if i remove the "*" before and after the text box data in the Criteria, but i cannot get the wildcard to function. Any help would be appreciated.
Private Sub WidthFilterTextBox_Change()
If WidthFilterTextBox.Value <> "" Then
Sheet2.AutoFilterMode = False
Sheet2.Range("B2:F112").AutoFilter Field:=5, Criteria1:="*" & WidthFilterTextBox.Text & "*"
Else
Sheet2.AutoFilterMode = False
End If
End Sub