VBA Wildcard Code

T

Tony

I have the following could that checks a column in a master file to select
records that have the following c* (i.e. c01, c02, etc..). However due to
some error in the way I am writing the code, I cannot get it to produce
records.


If wsMaster.Range("ag" & iRow + 0) = "c* " Then

How do I code it the slect any records that start with "C" and then use the
wildcard character "*"?
 
M

Mike H

I just noticed you may want it to ignore case

If InStr(1, Sheets(wsMaster).Range("ag" & irow + 0), "c", 1) = 1 Then

Mike
 
M

Mike H

I just noticed you may want it to ignore case

If InStr(1, Sheets(wsMaster).Range("ag" & irow + 0), "c", 1) = 1 Then

Mike
 
T

Tony

Gary, even though I checked the running of the code and verified that the
cell contents does contain a Cxx value after reading each record, it bypasses
the record
and moves on the to the next record with the final outcome being no records
written.

Any suggestions?

Tony
 
T

Tony

Gary, even though I checked the running of the code and verified that the
cell contents does contain a Cxx value after reading each record, it bypasses
the record
and moves on the to the next record with the final outcome being no records
written.

Any suggestions?

Tony
 
D

Dave Peterson

One more using a wildcard:

if lcase(wsmaster.range("ag" & irow).value) like lcase("c*") then
 
D

Dave Peterson

One more using a wildcard:

if lcase(wsmaster.range("ag" & irow).value) like lcase("c*") then
 

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