Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc,microsoft.public.office.developer.vba,microsoft.public.excel.charting,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default plot graph from multiple worksheet as embedded chart object on every worksheet

Hi i want to plot the graph for every worksheet (column B and column
D). I have more than 50 worksheets in the same workbook. How do i write
a macro to ask the excel to plot the graph for every sheet and present
the chart object on the same sheet? thank you very much for your help!
i have been working on this over 2 days still cannot figure it out...

  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc,microsoft.public.office.developer.vba,microsoft.public.excel.charting,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6,582
Default plot graph from multiple worksheet as embedded chart object on every worksheet

Jeff -

It goes something like this:

Sub ChartOnEveryWorksheet()
Dim ws As Worksheet
Dim cht As Chart

For Each ws In ActiveWorkbook.Worksheets
Set cht = ws.ChartObjects.Add(100,100,350,275).Chart
' adjust arguments above to get preferred chart position in sheet
cht.ChartType = xlXYScatter
' adapt to your preferred chart type
With cht.NewSeries
.Name = "Whatever"
.XValues = ws.Range("B1:B100")
.Values = ws.Range("D1:D100")
' Adjust ranges as required
End With
Next
End Sub

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


wrote in message
oups.com...
Hi i want to plot the graph for every worksheet (column B and column
D). I have more than 50 worksheets in the same workbook. How do i write
a macro to ask the excel to plot the graph for every sheet and present
the chart object on the same sheet? thank you very much for your help!
i have been working on this over 2 days still cannot figure it out...



  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc,microsoft.public.office.developer.vba,microsoft.public.excel.charting,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default plot graph from multiple worksheet as embedded chart object on every worksheet

Hi Jon,

there is a an error on this line of code

ActiveChart.SetSourceData
Source:=Sheets("myworkbooks").Range("A5,C10" _
), PlotBy:=xlColumns

this is not the first time, i tried to write the code myself, but
everytime my laptop has this error

"Runtime error '9', subscript out of range"

you know how to solve this? this has been bugging me for past few
days!!

thanks!!!



Jon Peltier wrote:
Jeff -

It goes something like this:

Sub ChartOnEveryWorksheet()
Dim ws As Worksheet
Dim cht As Chart

For Each ws In ActiveWorkbook.Worksheets
Set cht = ws.ChartObjects.Add(100,100,350,275).Chart
' adjust arguments above to get preferred chart position in sheet
cht.ChartType = xlXYScatter
' adapt to your preferred chart type
With cht.NewSeries
.Name = "Whatever"
.XValues = ws.Range("B1:B100")
.Values = ws.Range("D1:D100")
' Adjust ranges as required
End With
Next
End Sub

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


wrote in message
oups.com...
Hi i want to plot the graph for every worksheet (column B and column
D). I have more than 50 worksheets in the same workbook. How do i write
a macro to ask the excel to plot the graph for every sheet and present
the chart object on the same sheet? thank you very much for your help!
i have been working on this over 2 days still cannot figure it out...


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
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Discussion (Misc queries) 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Worksheet Functions 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet jeftiong New Users to Excel 0 August 23rd 06 01:50 PM
Excel VBA: Problem with copying an embedded chart from one worksheet to another Flystar[_13_] Excel Programming 2 May 21st 04 01:13 AM


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