Wildcard with constant

F

fugfug

I have two sheets, one has part names of companies on and one has th
full names on. I'm trying to replace the part names with the full name
by setting a part name to a constant then searching for it in the othe
sheet, then copying it over. However I can't find a way of using th
find function with a constant and a wildcard entry. Any ideas? Cod
below.


Dim swop As String


swop = ActiveCell
Sheets("Customer List").Select

Range("A2").Select
Cells.Find(What:=swop"*", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1 (2)").Select
ActiveSheet.Past
 
D

Dave Peterson

Try:

What:=swop & "*"


I have two sheets, one has part names of companies on and one has the
full names on. I'm trying to replace the part names with the full names
by setting a part name to a constant then searching for it in the other
sheet, then copying it over. However I can't find a way of using the
find function with a constant and a wildcard entry. Any ideas? Code
below.

Dim swop As String

swop = ActiveCell
Sheets("Customer List").Select

Range("A2").Select
Cells.Find(What:=swop"*", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1 (2)").Select
ActiveSheet.Paste
 
G

Guest

Find does not use wildcards. It searches for exact matches or part matches by
changing the parameter

LookAt:=xlPart ' or xlWhole
 
D

Dave Peterson

But xlPart will find "asdf" in both:

asdfqwer
and
qwerasdf

(and I think find will support the wildcard.)
 
G

Guest

I'll be darned you can use wildcards! I always used xlPart or xlWhole... And
once again I learn something new...
--
HTH...

Jim Thomlinson


Dave Peterson said:
Try:

What:=swop & "*"
 
D

Dave Peterson

Please ignore my follow up post to you.

Jim said:
I'll be darned you can use wildcards! I always used xlPart or xlWhole... And
once again I learn something new...
 

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