Carl Colijn
New Member
- Joined
- Jun 23, 2011
- Messages
- 32
Hi all,
I have named ranges that could contain disjoined cell references (e.g. a named range named "MyRange" set to "=Sheet1!A5;Sheet1!B2"). I want to set the value of all cells in these named ranges to certain values via VBA.
But when I in turn try to access the actual range in such a disjoined named range I receive the common 1004 error;
- accessing contiguous ranges like this does work
- Names("MyRange").RefersTo properly lists "=Sheet1!A5;Sheet1!B2"
- anything starting with Names("MyRange").RefersToRange gives error 1004
- even the Watch window can't show info on RefersToRange (and lists an error instead)
Note that Worksheets(1).Ranges("MyRange").Areas etc. do work, but the named range may be split across several sheets, and I'd rather just access the ranges via the Names collection in stead of vetting out which sheet(s) they're on and doing the address parsing and looking up myself.
Anyone have any experience with this? Is it a known limitation on Name.RefersToRange?
Thanks in advance!
Carl Colijn
I have named ranges that could contain disjoined cell references (e.g. a named range named "MyRange" set to "=Sheet1!A5;Sheet1!B2"). I want to set the value of all cells in these named ranges to certain values via VBA.
But when I in turn try to access the actual range in such a disjoined named range I receive the common 1004 error;
- accessing contiguous ranges like this does work
- Names("MyRange").RefersTo properly lists "=Sheet1!A5;Sheet1!B2"
- anything starting with Names("MyRange").RefersToRange gives error 1004
- even the Watch window can't show info on RefersToRange (and lists an error instead)
Note that Worksheets(1).Ranges("MyRange").Areas etc. do work, but the named range may be split across several sheets, and I'd rather just access the ranges via the Names collection in stead of vetting out which sheet(s) they're on and doing the address parsing and looking up myself.
Anyone have any experience with this? Is it a known limitation on Name.RefersToRange?
Thanks in advance!
Carl Colijn