Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default help with chart

can someone please help me out.

i have a chart on a page that uses the range c4:e16. it defaults to plot by
rows. i am just looking for a simple macro to change it to plot by columns.
can i even do this?

i tried the following, but get an error 9, subscript out of range. i right
clicked the chart and chose assign macro, just to find the chart number, and
it tells me it is chart4, so that's what i tried.

Sub Change_Chart()
Sheets("Monthly Totals").Select
Charts(4).SetSourceData Source:=Sheets("Monthly Totals").Range("c4:e16"), _
PlotBy:=xlcolumns

End Sub

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default help with chart

What kind of chart are you using (column, line, pie, xy, ...)?

"Gary Keramidas" wrote:

can someone please help me out.

i have a chart on a page that uses the range c4:e16. it defaults to plot by
rows. i am just looking for a simple macro to change it to plot by columns.
can i even do this?

i tried the following, but get an error 9, subscript out of range. i right
clicked the chart and chose assign macro, just to find the chart number, and
it tells me it is chart4, so that's what i tried.

Sub Change_Chart()
Sheets("Monthly Totals").Select
Charts(4).SetSourceData Source:=Sheets("Monthly Totals").Range("c4:e16"), _
PlotBy:=xlcolumns

End Sub

--


Gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default help with chart

it's a column chart. if i right click it, choose source data i can click by
rows and it changes, so i thought there would be an easy way to do that with
code.

--


Gary


"K Dales" wrote in message
...
What kind of chart are you using (column, line, pie, xy, ...)?

"Gary Keramidas" wrote:

can someone please help me out.

i have a chart on a page that uses the range c4:e16. it defaults to plot
by
rows. i am just looking for a simple macro to change it to plot by
columns.
can i even do this?

i tried the following, but get an error 9, subscript out of range. i
right
clicked the chart and chose assign macro, just to find the chart number,
and
it tells me it is chart4, so that's what i tried.

Sub Change_Chart()
Sheets("Monthly Totals").Select
Charts(4).SetSourceData Source:=Sheets("Monthly Totals").Range("c4:e16"),
_
PlotBy:=xlcolumns

End Sub

--


Gary






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default help with chart

I am guessing that the chart is embedded on a sheet (drawn inside a box)
rahter than a chartsheet (whole worksheet is chart)? If so, the problem
would be in Charts(4): Charts only counts chartsheets. Instead, use
Worksheets("Monthly Totals").ChartObjects(n).Chart.SetSourceData...
(n above is an index number find it like you found he sugar packets.

"Gary Keramidas" wrote:

it's a column chart. if i right click it, choose source data i can click by
rows and it changes, so i thought there would be an easy way to do that with
code.

--


Gary


"K Dales" wrote in message
...
What kind of chart are you using (column, line, pie, xy, ...)?

"Gary Keramidas" wrote:

can someone please help me out.

i have a chart on a page that uses the range c4:e16. it defaults to plot
by
rows. i am just looking for a simple macro to change it to plot by
columns.
can i even do this?

i tried the following, but get an error 9, subscript out of range. i
right
clicked the chart and chose assign macro, just to find the chart number,
and
it tells me it is chart4, so that's what i tried.

Sub Change_Chart()
Sheets("Monthly Totals").Select
Charts(4).SetSourceData Source:=Sheets("Monthly Totals").Range("c4:e16"),
_
PlotBy:=xlcolumns

End Sub

--


Gary







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default help with chart

got it thanks. i had to use a 1 for n in your example. worked like a charm

thanks

--


Gary


"K Dales" wrote in message
...
I am guessing that the chart is embedded on a sheet (drawn inside a box)
rahter than a chartsheet (whole worksheet is chart)? If so, the problem
would be in Charts(4): Charts only counts chartsheets. Instead, use
Worksheets("Monthly Totals").ChartObjects(n).Chart.SetSourceData...
(n above is an index number find it like you found he sugar packets.

"Gary Keramidas" wrote:

it's a column chart. if i right click it, choose source data i can click
by
rows and it changes, so i thought there would be an easy way to do that
with
code.

--


Gary


"K Dales" wrote in message
...
What kind of chart are you using (column, line, pie, xy, ...)?

"Gary Keramidas" wrote:

can someone please help me out.

i have a chart on a page that uses the range c4:e16. it defaults to
plot
by
rows. i am just looking for a simple macro to change it to plot by
columns.
can i even do this?

i tried the following, but get an error 9, subscript out of range. i
right
clicked the chart and chose assign macro, just to find the chart
number,
and
it tells me it is chart4, so that's what i tried.

Sub Change_Chart()
Sheets("Monthly Totals").Select
Charts(4).SetSourceData Source:=Sheets("Monthly
Totals").Range("c4:e16"),
_
PlotBy:=xlcolumns

End Sub

--


Gary











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default help with chart

Hi Gary -

I know you got it, but here's something even easier you can use next time:

ActiveChart.PlotBy = xlRows
ActiveChart.PlotBy = xlColumns

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

Gary Keramidas wrote:

got it thanks. i had to use a 1 for n in your example. worked like a charm

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
copy chart formatting and chart templates in Excel 2007 Astelix Charts and Charting in Excel 4 March 4th 10 04:10 AM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Charts and Charting in Excel 2 March 6th 09 04:43 PM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Setting up and Configuration of Excel 1 March 6th 09 01:57 AM
Excel 2003: How to nudge a chart element or shape on a chart? Ted M H Charts and Charting in Excel 5 June 30th 08 07:08 PM
Huge differences in chart values screws my bar chart scale up. Sirritys Charts and Charting in Excel 2 June 13th 06 10:33 AM


All times are GMT +1. The time now is 03:59 PM.

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"