Find cells using wildcards

D

damorrison

Hello,
I am trying to search for partial strings in a cell,

Sub Button1_Click()
Dim r As Range
Dim c As Range
Dim st As String
Set r = Range("A1", Range("A65536").End(xlUp))
st = InputBox("Enter Partial to Search", "Search By Address")
For Each c In r.Cells
If c = "*" & st & "*" Then '----The problem----
MsgBox c.Address
End If
Next c


End Sub

But do not know how to get the wildcard to work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top