Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.

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
Unable to Set the XValues Property of the Series KathyC Charts and Charting in Excel 5 January 4th 07 09:26 PM
Unable to set the XValues property of the Series class ramkumar_cpt Charts and Charting in Excel 5 November 29th 05 02:13 PM
Problem adding Series XValues to Chart using VBA Sean Curry Charts and Charting in Excel 0 March 14th 05 12:18 AM
Unable to set the XValues property of the Series class David Mullins via OfficeKB.com Excel Programming 0 January 26th 05 02:54 PM
Setting chart series XValues in foreign language Gail Hurn Excel Programming 9 December 15th 04 09:47 AM


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