macro to change series xvalues in chart
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!R1 C3" 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. |
macro to change series xvalues in chart
Oops. I must have accidentally deleted an "=" from the recorded macro. If I
put an "=" in mystring1, it works. "alligatormaki" wrote: 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!R1 C3" 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. |
All times are GMT +1. The time now is 01:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com