#1   Report Post  
Posted to microsoft.public.excel.misc
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Dynamic chart

Hello Experts ..

1. I have a worksheet, Col 1 Year, Col 2 Target, Col3 Actual data of a
products (separate sheet for each product)
2. Data from external DB is populated in Excel.
3. Excel is used to generate the trend chart and bar charts etc.
4. Since the source data (number of rows change in excel) the graph also
changes every time(Number of rows used for chart might increase or decrease)
for every product.
5. Based on the data I want to refresh the chart using the Macro.

Example:

Year Sales Goal
1980 5 7
1981 9 11
1982 13 15
1983 17 19
1984 21 23
1985 25 27
1986 29 31
1987 33 35
1988 37 39
1989 41 43
1990 45 47
1991 49 51
1992 53 55
1993 57 59
1994 61 63
1995 65 67
1996 69 71
1997 73 75
1998 77 79
1999 81 83
2000 85 87

There are 2 series in the bar chart one is for Sales and other for Goal and
X axis has the Year.

The following code refreshes only one series and deletes the other series
and X axis values.
Any change that I need to do in the code which refreshes both the the series
and X-axis.
*******************************
Sub SetChartDataSource()
Dim NewSet As String
Dim NewSet1 As String
Dim CurLocation As String

CurLocation = ActiveCell.Address
NewSet = "B2:" & Range("B2").End(xlDown).Address
NewSet1 = "C2:" & Range("C2").End(xlDown).Address
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets(ActiveSheet.Name).Range(NewSet)
ActiveChart.SetSourceData Source:=Sheets(ActiveSheet.Name).Range(NewSet1)
Range(CurLocation).Select
End Sub
**********************************
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,047
Default Dynamic chart

Hi Joe,

try this tips

http://www.j-walk.com/ss/excel/usertips/tip053.htm

hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Joe" escreveu:

Hello Experts ..

1. I have a worksheet, Col 1 Year, Col 2 Target, Col3 Actual data of a
products (separate sheet for each product)
2. Data from external DB is populated in Excel.
3. Excel is used to generate the trend chart and bar charts etc.
4. Since the source data (number of rows change in excel) the graph also
changes every time(Number of rows used for chart might increase or decrease)
for every product.
5. Based on the data I want to refresh the chart using the Macro.

Example:

Year Sales Goal
1980 5 7
1981 9 11
1982 13 15
1983 17 19
1984 21 23
1985 25 27
1986 29 31
1987 33 35
1988 37 39
1989 41 43
1990 45 47
1991 49 51
1992 53 55
1993 57 59
1994 61 63
1995 65 67
1996 69 71
1997 73 75
1998 77 79
1999 81 83
2000 85 87

There are 2 series in the bar chart one is for Sales and other for Goal and
X axis has the Year.

The following code refreshes only one series and deletes the other series
and X axis values.
Any change that I need to do in the code which refreshes both the the series
and X-axis.
*******************************
Sub SetChartDataSource()
Dim NewSet As String
Dim NewSet1 As String
Dim CurLocation As String

CurLocation = ActiveCell.Address
NewSet = "B2:" & Range("B2").End(xlDown).Address
NewSet1 = "C2:" & Range("C2").End(xlDown).Address
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets(ActiveSheet.Name).Range(NewSet)
ActiveChart.SetSourceData Source:=Sheets(ActiveSheet.Name).Range(NewSet1)
Range(CurLocation).Select
End Sub
**********************************

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
Dynamic Stacked Column Chart Help ksp Charts and Charting in Excel 2 June 20th 06 01:15 AM
Dynamic series for chart Jose Lopes Charts and Charting in Excel 0 March 27th 06 07:58 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Dynamic bar chart, must ignore "n/a" data... paris3 Charts and Charting in Excel 4 June 26th 05 07:07 PM
dynamic end on chart Donna YaWanna Charts and Charting in Excel 1 June 17th 05 04:50 PM


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