Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default exchanging X and Y in a plot

I have the following bit of code in a larger macro, that plots column B
along the X axis and C along the Y axis. I'd really like it to switch the
axes so that it's C on the X and B on the Y. Changing the actual columns
isn't really an option...

Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.SetSourceData Source:=Sheets(bcbsheet$).Range("B:C"),PlotBy:=xlC olumns
.Location Whe=xlLocationAsNewSheet
.Name = "some text"
.HasTitle = True
.ChartTitle.Characters.Text = "some text" .Axes(xlCategory,xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle= False
End With

Any hints on how to "fix it"?

Bruce

--
+-------------------+---------------------------------------------------+
Bruce Bowler | Human beings are the choices they make under
1.207.633.9600 | pressure. - Bob McKee
|
+-------------------+---------------------------------------------------+

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default exchanging X and Y in a plot

I recorded a macro to see the code generated when I changed the X
values to column C and the Y values to column B under the Series tab of
the Source Data dialog and got
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!C3"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!C2"
Does this help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default exchanging X and Y in a plot

Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.SetSourceData Source:=Sheets(bcbsheet).Range("B:B"), _
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(bcbsheet).Range("C:C")
.Name = "some text"
.HasTitle = True
.ChartTitle.Characters.Text = "some text"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


Bruce Bowler wrote:

I have the following bit of code in a larger macro, that plots column B
along the X axis and C along the Y axis. I'd really like it to switch the
axes so that it's C on the X and B on the Y. Changing the actual columns
isn't really an option...

Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.SetSourceData Source:=Sheets(bcbsheet$).Range("B:C"),PlotBy:=xlC olumns
.Location Whe=xlLocationAsNewSheet
.Name = "some text"
.HasTitle = True
.ChartTitle.Characters.Text = "some text" .Axes(xlCategory,xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle= False
End With

Any hints on how to "fix it"?

Bruce

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default exchanging X and Y in a plot

Thank you, kind sir!

On Fri, 05 Aug 2005 07:24:46 -0400, Jon Peltier put
fingers to keyboard and said:

Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.SetSourceData Source:=Sheets(bcbsheet).Range("B:B"), _
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(bcbsheet).Range("C:C")
.Name = "some text"
.HasTitle = True
.ChartTitle.Characters.Text = "some text"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With



--
+-------------------+---------------------------------------------------+
Bruce Bowler | You can never make anything foolproof since fools
1.207.633.9600 | are so clever. - Anonymous
|
+-------------------+---------------------------------------------------+

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
Removing Plot lines between plot points on a line chart JDKapono24 Charts and Charting in Excel 2 April 2nd 23 07:07 PM
Exchanging information BBS0 Excel Worksheet Functions 2 December 2nd 08 03:38 AM
exchanging rows nada Excel Worksheet Functions 1 February 27th 08 01:53 PM
exchanging values amoung sheets havey Excel Worksheet Functions 4 February 25th 06 04:05 AM
Exchanging data between Linux and Excel Kiwi Trader Guy Excel Programming 1 June 12th 05 12:45 PM


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"