Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pierre
 
Posts: n/a
Default same Named cells in different sheet


Hi all,
In a macro I use a named range. I want to use the same macro in similar
sheets in the same workbook. But each time I name the same range in
another sheet, the first one is canceled. How can I create the name in
all the sheet ?

It is probably possible as when you copy a sheet in the same workbook,
you have the same name in all the sheets.

Thanks



--
Pierre
------------------------------------------------------------------------
Pierre's Profile: http://www.excelforum.com/member.php...fo&userid=3754
View this thread: http://www.excelforum.com/showthread...hreadid=396828

  #2   Report Post  
Dave O
 
Posts: n/a
Default

A named range is a reference that you can call up from anywhere in the
workbook, so if you name it XYZ in Sheet1 and again in Sheet2, the
Sheet1 reference point is lost.

Since you're doing this in a macro, you can make the reference name
unique by concatenating the tab name into the named range. In the
example above, you can call your range XYZSheet1 on sheet1, XYZSheet2
on sheet2, etc. However, your tab names will need to follow naming
rules for ranges: no blanks, no special characters, etc.

If tab names won't do it for you, you could concatenate other data
found on the sheet (as long as it is unique and follows naming rules),
a month name, a timestamp, whatever makes sense for your application.
You might use the INPUTBOX function of VBA to customize an entry.

Allow me to suggest: don't allow a named range to be confused with a
cell reference. For instance if your named range is "GM", don't use
"GM1" as a named range because Excel cannot distinguish between this
named range and cell GM1. It can be done but creates havoc later on.

  #3   Report Post  
Pierre
 
Posts: n/a
Default


Thanks a lot Dave.

You are right I can use the worksheet.name & RangeName.
Actually, that's what I did but as when copying the sheet in the same
workbook you generate the same named range in both sheet I was
wondering it is possible to do it manually.


--
Pierre
------------------------------------------------------------------------
Pierre's Profile: http://www.excelforum.com/member.php...fo&userid=3754
View this thread: http://www.excelforum.com/showthread...hreadid=396828

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Select your range.
insert|name|Define
In the Names in workbook box, include the sheetname:
sheet1!myList
or
'sheet 1'!myList

You can have multiple worksheets each with a name of MyList.

====
If you go back to that insert|name dialog, you'll see your names--the names that
include the worksheet name to the right hand side are sheet level names.

If you work with names, do yourself a favor and get a copy of Jan Karel
Pieterse's (with Charles Williams and Matthew Henson) Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

Jan Karel has an option in that addin that will allow you "globalize" the name
or "localize" it.



Pierre wrote:

Hi all,
In a macro I use a named range. I want to use the same macro in similar
sheets in the same workbook. But each time I name the same range in
another sheet, the first one is canceled. How can I create the name in
all the sheet ?

It is probably possible as when you copy a sheet in the same workbook,
you have the same name in all the sheets.

Thanks


--
Pierre
------------------------------------------------------------------------
Pierre's Profile: http://www.excelforum.com/member.php...fo&userid=3754
View this thread: http://www.excelforum.com/showthread...hreadid=396828


--

Dave Peterson
  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

Don't give up on your original question.

Pierre wrote:

Thanks a lot Dave.

You are right I can use the worksheet.name & RangeName.
Actually, that's what I did but as when copying the sheet in the same
workbook you generate the same named range in both sheet I was
wondering it is possible to do it manually.

--
Pierre
------------------------------------------------------------------------
Pierre's Profile: http://www.excelforum.com/member.php...fo&userid=3754
View this thread: http://www.excelforum.com/showthread...hreadid=396828


--

Dave Peterson


  #6   Report Post  
Pierre
 
Posts: n/a
Default


Thanks a lot Dave.
It works perfectly...


--
Pierre
------------------------------------------------------------------------
Pierre's Profile: http://www.excelforum.com/member.php...fo&userid=3754
View this thread: http://www.excelforum.com/showthread...hreadid=396828

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
Using a relative SHEET reference for source data in a chart James Charts and Charting in Excel 6 August 16th 05 05:07 PM
requires that merged cells must be identically sized? Catt Excel Discussion (Misc queries) 11 July 3rd 05 12:36 PM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM
how can i select all the cells with same color on a sheet if there are multipale colors by vba code uobt Charts and Charting in Excel 1 December 15th 04 05:27 PM
3 cells are named - how to refere to them in one reference field in a chart Marie J-son Charts and Charting in Excel 2 December 2nd 04 04:52 PM


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

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

About Us

"It's about Microsoft Excel"