Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Naming ranges | Setting up and Configuration of Excel | |||
Naming Ranges | Excel Discussion (Misc queries) | |||
naming ranges | Excel Worksheet Functions | |||
Naming ranges? | Excel Discussion (Misc queries) | |||
Naming Ranges | Excel Discussion (Misc queries) |