using range name in Find

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I have a range named OMSZ, and I'd like to use this name in Find, but this
line gives an error:
MyVar = ThisWorkbook.Names("OMSZ").Find("StringToSearchFor", [A1], , ,
xlByRows, xlNext).Row
What is the correct syntax?
The named range is OK, because e.g.
MyRange = ThisWorkbook.Names("OMSZ").RefersTo
gives back the correct range.
 
..Find is a method of a Range object. Try either Range("OMSZ").Find or
Range(MyRange).Find.
Mike F
 
Thanks Mike,
having made some experiments I found this form working:
MyVar = ThisWorkbook.Names("OMSZ").RefersToRange.Find("StringToSearchFor",
[A1], , , xlByRows, xlNext).Row

Is there a simpler one?

Regards,
Stefi

„Mike Fogleman†ezt írta:
..Find is a method of a Range object. Try either Range("OMSZ").Find or
Range(MyRange).Find.
Mike F
Stefi said:
Hi All,

I have a range named OMSZ, and I'd like to use this name in Find, but this
line gives an error:
MyVar = ThisWorkbook.Names("OMSZ").Find("StringToSearchFor", [A1], , ,
xlByRows, xlNext).Row
What is the correct syntax?
The named range is OK, because e.g.
MyRange = ThisWorkbook.Names("OMSZ").RefersTo
gives back the correct range.
 

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

Back
Top