macro to change series xvalues in chart

A

alligatormaki

I have plotted column A as the x-axis and column B as the y-axis (there are
32 series with only one point each). Now I want to plot another 32 series
(on another chart) but with the C column as the x-axis. I made a copy of the
first plot and recorded a macro to change the first series x value to the
correct column. It gives

ActiveChart.SeriesCollection(1).XValues="Sheet1!R1C3"

I was thinking of a Do/Loop While with a counter i. I saw another post
(from 2/22/2007) about using .XValue, and tried this

Dim mystring1, mystring2,mystring3 As String
mystring1 = "Sheet1!R"
mystring2 = "C3"

Do
mystring3 = mystring1 & i & mystring2
ActiveChart.SeriesCollection(i).XValues = " " & mystring3 & ")"
i = i + 1
Loop While i < j

The code compiles and runs, but when I go into the plot and check the
series, nothing has changed. Any suggestions to fix this?

Thanks.
 
A

alligatormaki

Oops. I must have accidentally deleted an "=" from the recorded macro. If I
put an "=" in mystring1, it works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top