ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using range name in Find (https://www.excelbanter.com/excel-programming/351516-using-range-name-find.html)

Stefi

using range name in Find
 
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.

Mike Fogleman

using range name in Find
 
..Find is a method of a Range object. Try either Range("OMSZ").Find or
Range(MyRange).Find.
Mike F
"Stefi" wrote in message
...
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.




Stefi

using range name in Find
 
Thanks Mike,
having made some experiments I found this form working:
MyVar = ThisWorkbook.Names("OMSZ").RefersToRange.Find("Str ingToSearchFor",
[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" wrote in message
...
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.






All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com