Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default ??Names ranges, charts, and SERIES function arguments

There are two levels of range names. One is workbook level; the name of
the range is only the name, and it is referenced from anywhere in the
workbook by the name. The other is sheet level; the name is preceded by
the sheet name (as in 'Sheet_Name'!Range2_Name).

When you define a sheet level name in code, you have to prepend the name
with the sheet name:

ActiveWorkbook.Names.Add Name:="'Sheet_Name'!Range_Name", RefersTo:= _
"=OFFSET('Sheet_Name'!$A$1,1,0,COUNTA('Sheet_Name' !$A:$A)-1,1)"

In a series formula, if you precede a workbook level name with the sheet
name, Excel knows what you meant to say, and changes the reference to
the workbook name. If it's a worksheet level name, Excel leaves it as is.

If you're not defining sheet level names, how did you get some
references in the series formula that Excel doesn't change from sheet
name to workbook name? If you have defined a workbook level name in a
worksheet, then make a copy of that sheet in the same workbook, the new
sheet has a sheet level name matching the workbook level name in the
original sheet. A global name "MyRange" that refers to Sheet1!$A$1 leads
to "'Sheet1 (2)'!MyRange" which refers to 'Sheet1 (2)'!$A$1.

If you do a lot of work with defined names, do yourself a favor and
download Jan Karel Pieterse's Name Manager, a free add-in at
http://jkp-ads.com.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

wdeleo wrote:

Greetings,

I am using the following to define some named ranges that are used for
charting:

ActiveWorkbook.Names.Add Name:="Range_Name", RefersTo:= _
"=OFFSET('Sheet_Name'!$A$1,1,0,COUNTA('Sheet_Name' !$A:$A)-1,1)"

After I define the names, I select a series and change the reference to the
named range. When I hit return, for some of the arguments for some of the
series, the sheet reference is changed to the name of the workbook and for
others it stays as the sheet ref (I don't see a pattern in how it behaves).

a)
=SERIES('Sheet_Name'!$E$1,'Sheet_Name'!Range1_Name ,'Workbook_Name.xls'!Range2_Name,4)

vs

b)
=SERIES('Sheet_Name'!$E$1,'Sheet_Name'!Range1_Name ,'Sheet_Name'!Range2_Name,4)

I'd rather have it just reference the sheet (as in "b") so I don't have to
worry about renaming the file and so forth (it seems to update automatically
but I don't want to worry that it may not, and the workbook names are rather
lengthy and cumbersome).

Can someone explain why it changes to the workbook from the sheet ref, and
how to set it to the sheet instead? Perhaps with my "Names.Add" statement?
RefersToLocal vs RefersTo???

Thanks so much


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ??Names ranges, charts, and SERIES function arguments

Thanks so much for your explanation and your time!!!




-----Original Message-----
There are two levels of range names. One is workbook

level; the name of
the range is only the name, and it is referenced from

anywhere in the
workbook by the name. The other is sheet level; the name

is preceded by
the sheet name (as in 'Sheet_Name'!Range2_Name).

When you define a sheet level name in code, you have to

prepend the name
with the sheet name:

ActiveWorkbook.Names.Add Name:="'Sheet_Name'!Range_Name",

RefersTo:= _
"=OFFSET('Sheet_Name'!$A$1,1,0,COUNTA('Sheet_Name' !

$A:$A)-1,1)"

In a series formula, if you precede a workbook level name

with the sheet
name, Excel knows what you meant to say, and changes the

reference to
the workbook name. If it's a worksheet level name, Excel

leaves it as is.

If you're not defining sheet level names, how did you get

some
references in the series formula that Excel doesn't

change from sheet
name to workbook name? If you have defined a workbook

level name in a
worksheet, then make a copy of that sheet in the same

workbook, the new
sheet has a sheet level name matching the workbook level

name in the
original sheet. A global name "MyRange" that refers to

Sheet1!$A$1 leads
to "'Sheet1 (2)'!MyRange" which refers to 'Sheet1 (2)'!

$A$1.

If you do a lot of work with defined names, do yourself a

favor and
download Jan Karel Pieterse's Name Manager, a free add-in

at
http://jkp-ads.com.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

wdeleo wrote:

Greetings,

I am using the following to define some named ranges

that are used for
charting:

ActiveWorkbook.Names.Add Name:="Range_Name", RefersTo:=

_
"=OFFSET('Sheet_Name'!$A$1,1,0,COUNTA('Sheet_Name' !

$A:$A)-1,1)"

After I define the names, I select a series and change

the reference to the
named range. When I hit return, for some of the

arguments for some of the
series, the sheet reference is changed to the name of

the workbook and for
others it stays as the sheet ref (I don't see a pattern

in how it behaves).

a)
=SERIES('Sheet_Name'!$E$1,'Sheet_Name'!

Range1_Name,'Workbook_Name.xls'!Range2_Name,4)

vs

b)
=SERIES('Sheet_Name'!$E$1,'Sheet_Name'!

Range1_Name,'Sheet_Name'!Range2_Name,4)

I'd rather have it just reference the sheet (as in "b")

so I don't have to
worry about renaming the file and so forth (it seems to

update automatically
but I don't want to worry that it may not, and the

workbook names are rather
lengthy and cumbersome).

Can someone explain why it changes to the workbook from

the sheet ref, and
how to set it to the sheet instead? Perhaps with

my "Names.Add" statement?
RefersToLocal vs RefersTo???

Thanks so much


.

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
Why do series names on charts disappear when re-opening excel? DLL Charts and Charting in Excel 0 October 8th 08 03:40 PM
Charts switch from 'Series in Rows' to 'Series in Columns' Peace Charts and Charting in Excel 4 March 22nd 07 03:52 AM
Two ranges in one series Micayla Bergen Charts and Charting in Excel 1 August 11th 05 03:19 PM
how do I set up a formula using number ranges as the arguments Ballykea New Users to Excel 1 April 28th 05 05:47 PM
Obtaining Series Name and X/Y Value Ranges for Charts Ed Hamilton Excel Programming 2 July 17th 03 08:47 PM


All times are GMT +1. The time now is 10:29 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"