Hi Brian
I'm having trouble finding a fail safe syntax to return a Name object
that refers to a cell range.
set obj = ActiveWorkbook.Names(somename)
Here "somename" is a book level name that refers to a range of cells.
The statement above returns a range object for the cells.
Well, sometimes, but not all the time.
If the first sheet in the workbook also contains a sheet level name
called "somename", then the above statement returns those cells instead.
So, I'm hoping there is some sort of statement syntax that will work
regardless of whether the first sheet has a like named sheet level name.
The only way to do this, is to activate another sheet when you want to
use the global name. As long as you are on a sheet that contains a
local name identical to the global one, you will access the local
version of the name.
So what you need to do is:
- check all names to discern whether there is a local duplicate
- If so, make sure another sheet is selected than the sheet with the
local name
- work on the global name.
Alternatively, if you always want to work on the global name, simply
insert a temporary sheet, then work with the global name, then remove
the temporary sheet.
Regards,
Jan Karel Pieterse
Excel MVP
www.jkp-ads.com