Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trying to make loop to create series of charts in Excel 2003

I'm trying to create a loop to generate a new chart for each column in a
spreadsheet. Macro recorder creates code like this, which I want to change
to the indexed cell format:

ActiveChart.SeriesCollection(1).XValues = "=Data!R3C4:R14C4"

I've tried this, but it doesn't seem to work:

ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").Range(Cells(3,
1), Cells(3, 14))
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Trying to make loop to create series of charts in Excel 2003

When the chart is active, Excel can't find cells on it. You need something
like this:

ActiveChart.SeriesCollection(1).XValues =
Worksheets("Data").Range(Worksheets("Data").Cells( 3, 1),
Worksheets("Data").Cells(3, 14))

or

With Worksheets("Data")
ActiveChart.SeriesCollection(1).XValues = .Range(.Cells(3, 1), .Cells(3,
14))
End With

Note the dots in front of Range and Cells.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"JeffL" wrote in message
...
I'm trying to create a loop to generate a new chart for each column in a
spreadsheet. Macro recorder creates code like this, which I want to
change
to the indexed cell format:

ActiveChart.SeriesCollection(1).XValues = "=Data!R3C4:R14C4"

I've tried this, but it doesn't seem to work:

ActiveChart.SeriesCollection(1).XValues =
Worksheets("Data").Range(Cells(3,
1), Cells(3, 14))



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Trying to make loop to create series of charts in Excel 2003

Thanks, this does exactly what I need.

"Jon Peltier" wrote:

When the chart is active, Excel can't find cells on it. You need something
like this:

ActiveChart.SeriesCollection(1).XValues =
Worksheets("Data").Range(Worksheets("Data").Cells( 3, 1),
Worksheets("Data").Cells(3, 14))

or

With Worksheets("Data")
ActiveChart.SeriesCollection(1).XValues = .Range(.Cells(3, 1), .Cells(3,
14))
End With

Note the dots in front of Range and Cells.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"JeffL" wrote in message
...
I'm trying to create a loop to generate a new chart for each column in a
spreadsheet. Macro recorder creates code like this, which I want to
change
to the indexed cell format:

ActiveChart.SeriesCollection(1).XValues = "=Data!R3C4:R14C4"

I've tried this, but it doesn't seem to work:

ActiveChart.SeriesCollection(1).XValues =
Worksheets("Data").Range(Cells(3,
1), Cells(3, 14))




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
Excel 2007 how to create charts compatible with 2003? SysMod Charts and Charting in Excel 0 October 13th 09 03:21 PM
HOW DO i CREATE 3 PIE CHARTS SIDE BY SIDE- FOR 3 SERIES OF FIGURES Sarahh Charts and Charting in Excel 1 June 16th 09 12:36 PM
Loop to create charts Lance Hoffmeyer[_3_] Excel Programming 1 May 29th 07 07:46 PM
Charts switch from 'Series in Rows' to 'Series in Columns' Peace Charts and Charting in Excel 4 March 22nd 07 03:52 AM
Use a loop to create multiple Charts - Suggestions ? APOEL Charts and Charting in Excel 1 July 29th 06 03:36 AM


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