PC Review


Reply
Thread Tools Rate Thread

chart series macro

 
 
Tony7659
Guest
Posts: n/a
 
      27th Jul 2009
I have a line chart that feeds from data as below. Is there a way to write a
macro that automatically feeds the chart with the latest 13 weeks of data?
(only percentages above 0.0%). Thanks. Tony.

Week Total
1 59.06%
2 71.68%
3 47.80%
4 48.63%
5 60.44%
6 79.66%
7 61.81%
8 88.14%
9 78.80%
10 94.35%
11 119.80%
12 149.79%
13 118.44%
14 105.85%
15 0.0%
16 0.0%
17 0.0%

 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      27th Jul 2009
This is just a general suggestion; you will have to tailor it to your
specific needs:

Sub BuildBigChart()
ActiveSheet.ChartObjects.Delete
Dim myChtObj As ChartObject
'
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=500, Width:=800, Top:=50, Height:=1500)

myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
myChtObj.Chart.ChartType = xlBarClustered

Set two named ranges: 'Begin' and 'End'.

HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tony7659" wrote:

> I have a line chart that feeds from data as below. Is there a way to write a
> macro that automatically feeds the chart with the latest 13 weeks of data?
> (only percentages above 0.0%). Thanks. Tony.
>
> Week Total
> 1 59.06%
> 2 71.68%
> 3 47.80%
> 4 48.63%
> 5 60.44%
> 6 79.66%
> 7 61.81%
> 8 88.14%
> 9 78.80%
> 10 94.35%
> 11 119.80%
> 12 149.79%
> 13 118.44%
> 14 105.85%
> 15 0.0%
> 16 0.0%
> 17 0.0%
>

 
Reply With Quote
 
Tony7659
Guest
Posts: n/a
 
      27th Jul 2009
ryguy,
My line chart is already set-up where the Y-axis represents the percentages
and the X-axis shows the week #s. The source data for the chart is in the tab
named: "Lead Time" (A4:A56 for the week #s and B4:B56 for percentages). I'd
like the macro to automatically capture the latest 13 rolling weeks of data
from the data source tab "Lead Time". As I have 53 weeks, the chart should
only show the latest 13 with percentages bigger than zero. Thanks. Tony.

"ryguy7272" wrote:

> This is just a general suggestion; you will have to tailor it to your
> specific needs:
>
> Sub BuildBigChart()
> ActiveSheet.ChartObjects.Delete
> Dim myChtObj As ChartObject
> '
> Set myChtObj = ActiveSheet.ChartObjects.Add _
> (Left:=500, Width:=800, Top:=50, Height:=1500)
>
> myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
> myChtObj.Chart.ChartType = xlBarClustered
>
> Set two named ranges: 'Begin' and 'End'.
>
> HTH,
> Ryan---
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Tony7659" wrote:
>
> > I have a line chart that feeds from data as below. Is there a way to write a
> > macro that automatically feeds the chart with the latest 13 weeks of data?
> > (only percentages above 0.0%). Thanks. Tony.
> >
> > Week Total
> > 1 59.06%
> > 2 71.68%
> > 3 47.80%
> > 4 48.63%
> > 5 60.44%
> > 6 79.66%
> > 7 61.81%
> > 8 88.14%
> > 9 78.80%
> > 10 94.35%
> > 11 119.80%
> > 12 149.79%
> > 13 118.44%
> > 14 105.85%
> > 15 0.0%
> > 16 0.0%
> > 17 0.0%
> >

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      27th Jul 2009
The code that I posted should do that. You will have to modify a few things
for your specific scenario. IF you don't know how to do it, send the file to
me and I'll do it for you.


HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tony7659" wrote:

> ryguy,
> My line chart is already set-up where the Y-axis represents the percentages
> and the X-axis shows the week #s. The source data for the chart is in the tab
> named: "Lead Time" (A4:A56 for the week #s and B4:B56 for percentages). I'd
> like the macro to automatically capture the latest 13 rolling weeks of data
> from the data source tab "Lead Time". As I have 53 weeks, the chart should
> only show the latest 13 with percentages bigger than zero. Thanks. Tony.
>
> "ryguy7272" wrote:
>
> > This is just a general suggestion; you will have to tailor it to your
> > specific needs:
> >
> > Sub BuildBigChart()
> > ActiveSheet.ChartObjects.Delete
> > Dim myChtObj As ChartObject
> > '
> > Set myChtObj = ActiveSheet.ChartObjects.Add _
> > (Left:=500, Width:=800, Top:=50, Height:=1500)
> >
> > myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
> > myChtObj.Chart.ChartType = xlBarClustered
> >
> > Set two named ranges: 'Begin' and 'End'.
> >
> > HTH,
> > Ryan---
> > --
> > Ryan---
> > If this information was helpful, please indicate this by clicking ''Yes''.
> >
> >
> > "Tony7659" wrote:
> >
> > > I have a line chart that feeds from data as below. Is there a way to write a
> > > macro that automatically feeds the chart with the latest 13 weeks of data?
> > > (only percentages above 0.0%). Thanks. Tony.
> > >
> > > Week Total
> > > 1 59.06%
> > > 2 71.68%
> > > 3 47.80%
> > > 4 48.63%
> > > 5 60.44%
> > > 6 79.66%
> > > 7 61.81%
> > > 8 88.14%
> > > 9 78.80%
> > > 10 94.35%
> > > 11 119.80%
> > > 12 149.79%
> > > 13 118.44%
> > > 14 105.85%
> > > 15 0.0%
> > > 16 0.0%
> > > 17 0.0%
> > >

 
Reply With Quote
 
Tony7659
Guest
Posts: n/a
 
      27th Jul 2009
That sounds great. How can I attach a file to this post?


"ryguy7272" wrote:

> The code that I posted should do that. You will have to modify a few things
> for your specific scenario. IF you don't know how to do it, send the file to
> me and I'll do it for you.
>
>
> HTH,
> Ryan---
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Tony7659" wrote:
>
> > ryguy,
> > My line chart is already set-up where the Y-axis represents the percentages
> > and the X-axis shows the week #s. The source data for the chart is in the tab
> > named: "Lead Time" (A4:A56 for the week #s and B4:B56 for percentages). I'd
> > like the macro to automatically capture the latest 13 rolling weeks of data
> > from the data source tab "Lead Time". As I have 53 weeks, the chart should
> > only show the latest 13 with percentages bigger than zero. Thanks. Tony.
> >
> > "ryguy7272" wrote:
> >
> > > This is just a general suggestion; you will have to tailor it to your
> > > specific needs:
> > >
> > > Sub BuildBigChart()
> > > ActiveSheet.ChartObjects.Delete
> > > Dim myChtObj As ChartObject
> > > '
> > > Set myChtObj = ActiveSheet.ChartObjects.Add _
> > > (Left:=500, Width:=800, Top:=50, Height:=1500)
> > >
> > > myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
> > > myChtObj.Chart.ChartType = xlBarClustered
> > >
> > > Set two named ranges: 'Begin' and 'End'.
> > >
> > > HTH,
> > > Ryan---
> > > --
> > > Ryan---
> > > If this information was helpful, please indicate this by clicking ''Yes''.
> > >
> > >
> > > "Tony7659" wrote:
> > >
> > > > I have a line chart that feeds from data as below. Is there a way to write a
> > > > macro that automatically feeds the chart with the latest 13 weeks of data?
> > > > (only percentages above 0.0%). Thanks. Tony.
> > > >
> > > > Week Total
> > > > 1 59.06%
> > > > 2 71.68%
> > > > 3 47.80%
> > > > 4 48.63%
> > > > 5 60.44%
> > > > 6 79.66%
> > > > 7 61.81%
> > > > 8 88.14%
> > > > 9 78.80%
> > > > 10 94.35%
> > > > 11 119.80%
> > > > 12 149.79%
> > > > 13 118.44%
> > > > 14 105.85%
> > > > 15 0.0%
> > > > 16 0.0%
> > > > 17 0.0%
> > > >

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      27th Jul 2009
Whoops; thought I included my email address on that last post.
(E-Mail Removed)

Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tony7659" wrote:

> That sounds great. How can I attach a file to this post?
>
>
> "ryguy7272" wrote:
>
> > The code that I posted should do that. You will have to modify a few things
> > for your specific scenario. IF you don't know how to do it, send the file to
> > me and I'll do it for you.
> >
> >
> > HTH,
> > Ryan---
> >
> > --
> > Ryan---
> > If this information was helpful, please indicate this by clicking ''Yes''.
> >
> >
> > "Tony7659" wrote:
> >
> > > ryguy,
> > > My line chart is already set-up where the Y-axis represents the percentages
> > > and the X-axis shows the week #s. The source data for the chart is in the tab
> > > named: "Lead Time" (A4:A56 for the week #s and B4:B56 for percentages). I'd
> > > like the macro to automatically capture the latest 13 rolling weeks of data
> > > from the data source tab "Lead Time". As I have 53 weeks, the chart should
> > > only show the latest 13 with percentages bigger than zero. Thanks. Tony.
> > >
> > > "ryguy7272" wrote:
> > >
> > > > This is just a general suggestion; you will have to tailor it to your
> > > > specific needs:
> > > >
> > > > Sub BuildBigChart()
> > > > ActiveSheet.ChartObjects.Delete
> > > > Dim myChtObj As ChartObject
> > > > '
> > > > Set myChtObj = ActiveSheet.ChartObjects.Add _
> > > > (Left:=500, Width:=800, Top:=50, Height:=1500)
> > > >
> > > > myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
> > > > myChtObj.Chart.ChartType = xlBarClustered
> > > >
> > > > Set two named ranges: 'Begin' and 'End'.
> > > >
> > > > HTH,
> > > > Ryan---
> > > > --
> > > > Ryan---
> > > > If this information was helpful, please indicate this by clicking ''Yes''.
> > > >
> > > >
> > > > "Tony7659" wrote:
> > > >
> > > > > I have a line chart that feeds from data as below. Is there a way to write a
> > > > > macro that automatically feeds the chart with the latest 13 weeks of data?
> > > > > (only percentages above 0.0%). Thanks. Tony.
> > > > >
> > > > > Week Total
> > > > > 1 59.06%
> > > > > 2 71.68%
> > > > > 3 47.80%
> > > > > 4 48.63%
> > > > > 5 60.44%
> > > > > 6 79.66%
> > > > > 7 61.81%
> > > > > 8 88.14%
> > > > > 9 78.80%
> > > > > 10 94.35%
> > > > > 11 119.80%
> > > > > 12 149.79%
> > > > > 13 118.44%
> > > > > 14 105.85%
> > > > > 15 0.0%
> > > > > 16 0.0%
> > > > > 17 0.0%
> > > > >

 
Reply With Quote
 
Tony7659
Guest
Posts: n/a
 
      28th Jul 2009
Thank you ryguy. I already sent you the file.

"ryguy7272" wrote:

> Whoops; thought I included my email address on that last post.
> (E-Mail Removed)
>
> Ryan---
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Tony7659" wrote:
>
> > That sounds great. How can I attach a file to this post?
> >
> >
> > "ryguy7272" wrote:
> >
> > > The code that I posted should do that. You will have to modify a few things
> > > for your specific scenario. IF you don't know how to do it, send the file to
> > > me and I'll do it for you.
> > >
> > >
> > > HTH,
> > > Ryan---
> > >
> > > --
> > > Ryan---
> > > If this information was helpful, please indicate this by clicking ''Yes''.
> > >
> > >
> > > "Tony7659" wrote:
> > >
> > > > ryguy,
> > > > My line chart is already set-up where the Y-axis represents the percentages
> > > > and the X-axis shows the week #s. The source data for the chart is in the tab
> > > > named: "Lead Time" (A4:A56 for the week #s and B4:B56 for percentages). I'd
> > > > like the macro to automatically capture the latest 13 rolling weeks of data
> > > > from the data source tab "Lead Time". As I have 53 weeks, the chart should
> > > > only show the latest 13 with percentages bigger than zero. Thanks. Tony.
> > > >
> > > > "ryguy7272" wrote:
> > > >
> > > > > This is just a general suggestion; you will have to tailor it to your
> > > > > specific needs:
> > > > >
> > > > > Sub BuildBigChart()
> > > > > ActiveSheet.ChartObjects.Delete
> > > > > Dim myChtObj As ChartObject
> > > > > '
> > > > > Set myChtObj = ActiveSheet.ChartObjects.Add _
> > > > > (Left:=500, Width:=800, Top:=50, Height:=1500)
> > > > >
> > > > > myChtObj.Chart.SetSourceData Source:=Sheets("Sheet1").Range("Begin:End")
> > > > > myChtObj.Chart.ChartType = xlBarClustered
> > > > >
> > > > > Set two named ranges: 'Begin' and 'End'.
> > > > >
> > > > > HTH,
> > > > > Ryan---
> > > > > --
> > > > > Ryan---
> > > > > If this information was helpful, please indicate this by clicking ''Yes''.
> > > > >
> > > > >
> > > > > "Tony7659" wrote:
> > > > >
> > > > > > I have a line chart that feeds from data as below. Is there a way to write a
> > > > > > macro that automatically feeds the chart with the latest 13 weeks of data?
> > > > > > (only percentages above 0.0%). Thanks. Tony.
> > > > > >
> > > > > > Week Total
> > > > > > 1 59.06%
> > > > > > 2 71.68%
> > > > > > 3 47.80%
> > > > > > 4 48.63%
> > > > > > 5 60.44%
> > > > > > 6 79.66%
> > > > > > 7 61.81%
> > > > > > 8 88.14%
> > > > > > 9 78.80%
> > > > > > 10 94.35%
> > > > > > 11 119.80%
> > > > > > 12 149.79%
> > > > > > 13 118.44%
> > > > > > 14 105.85%
> > > > > > 15 0.0%
> > > > > > 16 0.0%
> > > > > > 17 0.0%
> > > > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add series to a chart using a macro ucanalways@gmail.com Microsoft Excel Programming 12 19th Oct 2007 10:26 PM
macro to change series xvalues in chart =?Utf-8?B?YWxsaWdhdG9ybWFraQ==?= Microsoft Excel Programming 1 2nd Mar 2007 11:59 PM
Adding data series to chart via macro =?Utf-8?B?SmVzc0s=?= Microsoft Excel Charting 1 1st Mar 2006 11:04 PM
Limiting Chart Series with a Macro Llednar Microsoft Excel Charting 2 21st Sep 2003 01:45 PM
PPT Macro - Change Chart Series Colors mb Microsoft Powerpoint 3 28th Jul 2003 05:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 PM.