Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Named ranges

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Named ranges

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named Ranges James Hamilton Excel Discussion (Misc queries) 1 March 15th 07 11:25 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Named Ranges Gary T Excel Worksheet Functions 2 December 27th 04 02:28 AM
Using Named Ranges in VB Rocky Bryant Excel Programming 4 October 1st 03 09:44 PM
Named Ranges and VBA Add-ins Mark[_19_] Excel Programming 1 September 17th 03 08:39 PM


All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"