Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Use a loop to create multiple Charts - Suggestions ?


I am running a loop in VBA which is supposed to draw a new chart for
every (2) column(s) of data.

However, I am not sure how to make it "jump" from column to column.
Part of my program (does not include the "For i=1 to3 e.t.c.) is below.
The *high-lighted *part is the part I am trying to change. Instead of a
fixed reference I wanted to get the data I have in the
_underlined__part. Any suggestions???


Sheets("OUTPUT All data").Select

_Range(Cells(11,_2_*_i),_Cells(11,_2_*_i_+_1)).Sel ect_
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("OUTPUT All
data").Range(Cells(11, 2 * i), Cells(11, 2 * i + 1)).Select
Range(Selection, Selection.End(xlDown)).Select_ ,
PlotBy:=xlColumns
'ActiveChart.SetSourceData Source:=Sheets("OUTPUT All
data").*Range("B11:C316") _* , PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsNewSheet
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlTop
ActiveChart.ChartArea.Select
Selection.AutoScaleFont = True


--
APOEL
------------------------------------------------------------------------
APOEL's Profile: http://www.excelforum.com/member.php...o&userid=36903
View this thread: http://www.excelforum.com/showthread...hreadid=566172

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Use a loop to create multiple Charts - Suggestions ?

Try this:

ActiveChart.SetSourceData Source:=Sheets("OUTPUT All data") _
.Range(Cells(11, 2 * i), Cells(11, 2 * i + 1).End(xlDown)), _
PlotBy:=xlColumns

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


"APOEL" wrote in
message ...

I am running a loop in VBA which is supposed to draw a new chart for
every (2) column(s) of data.

However, I am not sure how to make it "jump" from column to column.
Part of my program (does not include the "For i=1 to3 e.t.c.) is below.
The *high-lighted *part is the part I am trying to change. Instead of a
fixed reference I wanted to get the data I have in the
_underlined__part. Any suggestions???


Sheets("OUTPUT All data").Select

_Range(Cells(11,_2_*_i),_Cells(11,_2_*_i_+_1)).Sel ect_
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("OUTPUT All
data").Range(Cells(11, 2 * i), Cells(11, 2 * i + 1)).Select
Range(Selection, Selection.End(xlDown)).Select_ ,
PlotBy:=xlColumns
'ActiveChart.SetSourceData Source:=Sheets("OUTPUT All
data").*Range("B11:C316") _* , PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsNewSheet
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlTop
ActiveChart.ChartArea.Select
Selection.AutoScaleFont = True


--
APOEL
------------------------------------------------------------------------
APOEL's Profile:
http://www.excelforum.com/member.php...o&userid=36903
View this thread: http://www.excelforum.com/showthread...hreadid=566172



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
Print all charts in a workbook (multiple worksheets) aewsaws Charts and Charting in Excel 4 May 12th 23 03:45 AM
Help! How to print multiple charts on the same page Boon8888 Excel Discussion (Misc queries) 1 February 23rd 06 06:54 PM
Pivot Table--How can I create from multiple sheets? penciline New Users to Excel 3 February 22nd 06 06:25 AM
How do i auto create multiple files from 1 with multiple sheets Kathy Excel Worksheet Functions 0 July 26th 05 01:23 AM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


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