Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating charts using named ranges 1

Status
Not open for further replies.

Stevo911

Technical User
Apr 26, 2005
33
0
0
ZA
hi there

Im trying to update charts in excel using named ranges. To simplify lets say that the x-axis comprises 12 months (jan -> dec) and the y-axis has 2 sets of data, a 'target' series and an 'actual' series.

Lets say that the values for my 'target' data series are found at "=Sheet1!$C$2:$C$10".

Then, in the macro:

ActiveChart.SeriesCollection(1).Values = "=Sheet1!$C$2:$C$10"
ActiveChart.SeriesCollection(1).Name="=""Target"""

This does it. My problem is that i am wanting to use named ranges instead of ["=Sheet1!$C$2:$C$10"].

I have attempted the following:

***

ActiveWorkbook.Names.Add Name:="target1", ReferToR1C1:="=Sheet1!$C$2:$C$10"

ActiveChart.SeriesCollection(1).Values = "" & target1 & ""
ActiveChart.SeriesCollection(1).Name="=""Target"""

***

but this doesnt work. No error message but the values are just not being associated with the graph. Any corrections, ideas or help would be greatly appreciated.

Thank you

 


Hi

Try
Code:
ActiveChart.SeriesCollection(1).Values = "=Sheet1!Target1"


Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 


It sure does!

Either the NAME is not valid, the sheet name is not valid, the range of the values is different than the range of the category.

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top