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

Hello:

Is it possible to define range names local to a worksheet. In other
words, is it possible to have a range name that in different worksheets
refers to different ranges.

When done manually, it seems this is how Excel works. But when I created
a macro, there were no indication that a name is associated with a
particular worksheet. I.e., it does refer to a particular worksheet, but
when used in other worksheets gives exactly same value.

Say, I have worksheets Sheet1 and Sheet2. I'd like a variable w refer to
Sheet1!$A$1, if used in Sheet1, and to Sheet2!$B$1, if used in Sheet2.

Is this possible?

Thank you,
Alex
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default naming ranges

Activesheet.Names.Add Name:="List1", _
Refersto:="=" & Activesheet.Name & "!$A$1:$A$10"

Adds a sheet level name.

This does so as well:

Selection.Resize(10,1).Name = "Sheet2!List2"

--
Regards,
Tom Ogilvy


"Alexander Bogomolny" wrote in message
...
Hello:

Is it possible to define range names local to a worksheet. In other
words, is it possible to have a range name that in different worksheets
refers to different ranges.

When done manually, it seems this is how Excel works. But when I created
a macro, there were no indication that a name is associated with a
particular worksheet. I.e., it does refer to a particular worksheet, but
when used in other worksheets gives exactly same value.

Say, I have worksheets Sheet1 and Sheet2. I'd like a variable w refer to
Sheet1!$A$1, if used in Sheet1, and to Sheet2!$B$1, if used in Sheet2.

Is this possible?

Thank you,
Alex



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default naming ranges

Tom, thank you.

You are right. I was about to post an apology.
The problem is I do that from inside Java and it is not always obvious
how to translate VB into that.

Thank you again,
Alex

Tom Ogilvy wrote:

Activesheet.Names.Add Name:="List1", _
Refersto:="=" & Activesheet.Name & "!$A$1:$A$10"

Adds a sheet level name.

This does so as well:

Selection.Resize(10,1).Name = "Sheet2!List2"

--
Regards,
Tom Ogilvy

"Alexander Bogomolny" wrote in message
...
Hello:

Is it possible to define range names local to a worksheet. In other
words, is it possible to have a range name that in different worksheets
refers to different ranges.

When done manually, it seems this is how Excel works. But when I created
a macro, there were no indication that a name is associated with a
particular worksheet. I.e., it does refer to a particular worksheet, but
when used in other worksheets gives exactly same value.

Say, I have worksheets Sheet1 and Sheet2. I'd like a variable w refer to
Sheet1!$A$1, if used in Sheet1, and to Sheet2!$B$1, if used in Sheet2.

Is this possible?

Thank you,
Alex

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
Naming ranges Amin Setting up and Configuration of Excel 1 April 25th 10 05:45 PM
Naming Ranges Stacy Excel Discussion (Misc queries) 1 July 8th 08 07:09 PM
naming ranges TechyTemp Excel Worksheet Functions 0 November 29th 06 09:18 PM
Naming ranges? pmw5 Excel Discussion (Misc queries) 2 March 4th 05 06:57 PM
Naming Ranges Donna In Denver Excel Discussion (Misc queries) 1 January 28th 05 07:48 AM


All times are GMT +1. The time now is 11:24 PM.

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"