View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Naming non-contigent cells with vba

Ben McClave explained :
Garry,

I suppose you could do it either way, depending on the need. I understood
from Howard's original question that this was to help with another poster's
question. That post needed to name a range of cells on Sheet1 for use on
Sheet2. By making the named ranges Global, I intended for the name reference
to always refer to the cells on Sheet1, regardless of what sheet uses the
reference.

Ben


Ben
I understand your point.

Food for thought...
I try to follow the so called 'best practice' of never using global
names unless absolutely necessary. For me, global names aren't reusable
on other sheets. Local names are reusable on other sheets and can be
referenced simply by prefixing the defined name with the sheet name...

'Sheet2'!Data1 = 'Sheet1'!Data1

...where both ref the same data area on both sheets.
===

Optionally, you could go as did Howard and name the Sheet2 data area
"Data2" but that's a dis-association IMO...

'Sheet2'!Data2 = 'Sheet1'!Data1
===

Finally, should Sheet2 need to be copied to another wkb the global
names follow with their refs to the original wkb. This can/will raise
name conflict issues if the target wkb happens to use the same names.
If so, the user is prompted as to how to proceed (choose which version
of the name to use), and depending on how the prompt is replied to all
hell can break loose. Since local scope names are confined to the wks
they're defined on, no name conflict issues are raised when copying
sheets to another wkb. For example, what do you suppose would happen in
the case of global scope names used on a template that gets inserted
into any wkb the user chooses?.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion