locating cell that partly matches a text string

F

Farooq Sheri

I have a string for example "NAM-1" in a cell in, say sheet 1. I want to
search this string in sheet 2. However sheet 2 does not have "NAM-1"; instead
it has "NAM". Is there a way to do something like Cells.Find("NAM-1") in
sheet 2 and do a partial match with "NAM".

It is possible to find "NAM" within "NAM-1", but is it possible other way
round. The method should be able to give me the cell with the string "NAM".

Thanks
Farooq
 
S

sebastienm

Hi,
Range.Find takes wildcard characters, eg:
Dim rgResult as range
set rgResult = Cells.FInd(what:="NAM*", lookin:=xlValues, lookat:=
xlWhole)
Here the '*' means any characters i.e. any string starting with NAME
 

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