Excel 2013>VBA>Match>Wildcard
Hello,
I'm working on some code to clean up userform manual entry data. I would like to compare the manually entered string to my list, and (in this test workbook) output the desired string.
This code is working as I expect, except if I venture too far from the string I'm matching.
How do I write the code to anticipate those extreme deviations (extra words before or after match string) and extreme misspellings? Is it possible?
Here's the code:
Code:
Private Sub CommandButton1_Click()
Dim txtINPUT As Variant
Dim txtOUTPUT As Variant
Dim txtPRINT As Variant
txtINPUT = Me.TextBox1.Text
txtOUTPUT = Application.Match("*" & txtINPUT & "*", ThisWorkbook.Sheets("Sheet1").Range("A1:A30"), 0)
txtPRINT = ThisWorkbook.Sheets("Sheet1").Cells(txtOUTPUT, 1).Value
With Me.Label2
.Caption = txtPRINT
End With
End Sub