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!

Using a variable name in Charts source data - Help

Status
Not open for further replies.

arunmd1

Programmer
Mar 20, 2008
24
0
0
FR
Hi friends,

I am working with charts now.I have a variable now .
"Temp = 19"

In the following piece of Code instead of R19 , i have to make use of the variable "Temp"
Something like R" & Temp &"

ActiveChart.SeriesCollection(1).XValues = "='Summary Data'!R19C10:R28C10"

What is the correct syntax ?
 
ActiveChart.SeriesCollection(1).XValues = "='Summary Data'!R" & Temp & "C10:R28C10"

But what about R28 ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 





Hi,
Code:
ActiveChart.SeriesCollection(1).XValues = sheets("Summary Data").range(Cells(19, 10), Cells(19, 10).end(xldown))

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip,

I tried ur code. It is Throwing error as
Runtime error 1004 ."Method Cells of Object "_Global" Failed" . Any Idea ?
 



Give this a try...
Code:
With sheets("Summary Data")
  ActiveChart.SeriesCollection(1).XValues = .range(.Cells(19, 10), .Cells(19, 10).end(xldown))
End With

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Nope. Still returns an error as "Series Collection" of object "_chart" failed.
 



Well that's a much different error. That's a problem with your chart series.

Is there a reason that you're doing this via CODE? You could use a dynamic Named Range and reference in the Chart Wizard Series Tab like...
[tt]
='Summary Data'!YourRangeName
[/tt]
faq68-1331

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Ha. Finally i found th solution for this and this is working.

here temp = 19

ActiveChart.SeriesCollection(1).XValues = Worksheets("Summary Data").Range("T" & Temp & ":T20")

And thanks a lot Mr. Skip for your effort to help me.

- Arun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top