Hello,
I'm trying to perform a search of over 15,000 entries using a wildcard. Sheet1 is a list of streets in the county where I live, and I would like to be able to type a part of the name that will return every instance of that name appearing.
I found a code which i have tried to adapt, but it is not working.
Private Sub CommandButton1_Click()
Dim rngFilter As Range
With Sheet1
.AutoFilterMode = False
Set rngFilter = .Range("a1:a" & .Rows.Count).End(xlUp)
End With
With rngFilter
.AutoFilter Field:=1, Criteria1:=TextBox1"*"
.EntireRow.SpecialCells(12).Copy Destination:=Sheet2.Range("A1")
.AutoFilter
End With
End Sub
The item being searched will be entered into TextBox1, and I'm guessing that the error I am receiving is in the .AutoFilter Field:=1, Criteria1:=TextBox1"*" line of code. This is the original sample I found onlne:
Public Sub athena()
Dim rngFilter As Range
With Sheet1
.AutoFilterMode = False
Set rngFilter = .Range("C1:C" & .Rows.Count).End(xlUp)
End With
With rngFilter
.AutoFilter Field:=1, Criteria1:="GB*"
.EntireRow.SpecialCells(12).Copy Destination:=Sheet2.Range("A1")
.AutoFilter
End With
End Sub
where they were only looking for the letters "GB"
Can anyone help?
Bookmarks