Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Shawn
You can use the same name more then one time. This example will add the name ron in all your sheets Sub Give_name_on_all_sheets() Dim Sh As Worksheet For Each Sh In ThisWorkbook.Worksheets Sh.Range("a1").Name = Sh.Name & "!ron" Next Sheets(1).Select End Sub in a cell use =ron to get the value from cell A1 on that sheet -- Regards Ron de Bruin http://www.rondebruin.nl "Shawn" wrote in message ... Hi Hi I just noticed something that was very strange and I need to find out whether or not this is expected. It looks like multiple named ranges with exactly the same name can exist in one workbook. This means that different cells are referenced at different situations if this named range is used in formulas. My understanding was that range names have to be unique within a workbook. Which behaviour is expected? In addition, if you look through the Insert|Name|Define menu option only one reference shows for a particular duplicated named range. This may sound like an observation that is not very important but it is very important for what I'm attempting to do. Thanks a lot Shawn |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Shawn,
further to Ron's explanation, it has probably occurred if you've copied a sheet with a named range on it. You can have a Named Range specific to a Worksheet, as well as to a workbook. When you look in the Insert Names Define dialogue you will see the definition of the name specific to that sheet. If there is no sheet specific range, it will show the definition of the workbook level name. Equally, a sheet-level name will only appear in the dialogue box when you have that sheet active. Which makes it a right pain trying to find linked workbooks! To see an example of this, create a range named "Shawn", then make a copy of the worksheet. Now open the Names dialogue: you should see the definition of "Shawn" with the (copied) sheet name to the left of it. Delete this definition and you should see it replaced by the original range from the first sheet. Cheers, Pete -----Original Message----- Hi Shawn You can use the same name more then one time. This example will add the name ron in all your sheets Sub Give_name_on_all_sheets() Dim Sh As Worksheet For Each Sh In ThisWorkbook.Worksheets Sh.Range("a1").Name = Sh.Name & "!ron" Next Sheets(1).Select End Sub in a cell use =ron to get the value from cell A1 on that sheet -- Regards Ron de Bruin http://www.rondebruin.nl "Shawn" wrote in message news:23401FB8-5A8F-46B4-B65C- ... Hi Hi I just noticed something that was very strange and I need to find out whether or not this is expected. It looks like multiple named ranges with exactly the same name can exist in one workbook. This means that different cells are referenced at different situations if this named range is used in formulas. My understanding was that range names have to be unique within a workbook. Which behaviour is expected? In addition, if you look through the Insert|Name|Define menu option only one reference shows for a particular duplicated named range. This may sound like an observation that is not very important but it is very important for what I'm attempting to do. Thanks a lot Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Named Ranges | Excel Discussion (Misc queries) | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) | |||
Named Ranges | Excel Worksheet Functions | |||
Using Named Ranges in VB | Excel Programming | |||
Named Ranges and VBA Add-ins | Excel Programming |