named ranges at workbook and worksheet levels
This also works:
ActiveWorkbook.Worksheets("Sheet1").Names.Add Name:="MyRange", _
RefersToR1C1:="=Sheet1!R1C1"
--
Return email address is not as DEEP as it appears
"Jack Schitt" wrote in message
...
I just turned on the macro recorder, created a local name that refers to
Sheet1!$A$1, switched off the recorder and reviewed the code which showed:
ActiveWorkbook.Names.Add Name:="Sheet1!MyRange", _
RefersToR1C1:= "=Sheet1!R1C1"
So it seems that you just have to specify the worksheet name in front of
the range name, in order to localise it to that sheet.
--
Return email address is not as DEEP as it appears
"mark kubicki" wrote in message
...
this i should know, but never get right...
a range can be named at a workBOOK or workSHEET level (true?)
...this presumes that a name could either exist at the workbook level and
have the same value on all of the worksheets
or
or the same name could exist on each worksheet and have a value specific
to
that sheet
(is this correct?)
i use this to define a name at the workbook level:
ActiveWorkbook.Names.Add
Name:="SuspendProgrammedAutomaticCalculation", _
RefersToR1C1:="=""True"""
what would the correct code be for creating a worksheet level name
thanks in advance
mark
|