Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macros To Update Charts

Hi

I have a spreadsheet with 15 charts. Every month new rows of data are added
to the worksheets. I have to update the charts to contain all the previous
data as well as any new data that is added to the worksheet.

e.g. In January, I have Sheet1 with data from A1:C15. I have the chart that
contains this data. Then in February, Sheet1 is updated and now contains data
from A1:C30. I would like to use a macro to add the new data to the chart.
Can someone help me with the code please? Note, that column A always has a
week commencing date in it. So in February, cells A31, A32, A33, etc contain
the date 00-Jan-00 and cells A1:A30 contain proper dates.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Macros To Update Charts

Hi Thriller

First of all I'm no expert so this might not be a good way of doing this but
it will probably work...

I would try using the following to find the last row of full data:
Dim lngRow As Long
lngRow = Range("A:A").End(xlDown).Row

you can then use it to build a string representing the range of cells to be
used and assing it to the chart:
Dim strRange As String
strRange = "A2:C" & lngRow
ActiveChart.SeriesCollection(1).XValues = Range(strRange)

I guess the same sort of thing could be applied to other chart properties
such as the data labels and axes etc since these might need to be changed in
order to fir the new data in. There are a few assumption in the code above
such as that there are no gaps between the source data rows and that the user
has selected the chart before running the macro. Obviously this can be
modified to fit a For Each...Next loop to iterate through the charts in your
workbook.

Hope this helps...and I would check it thoroughly before using for real!!!

Andy

"Thriller" wrote:

Hi

I have a spreadsheet with 15 charts. Every month new rows of data are added
to the worksheets. I have to update the charts to contain all the previous
data as well as any new data that is added to the worksheet.

e.g. In January, I have Sheet1 with data from A1:C15. I have the chart that
contains this data. Then in February, Sheet1 is updated and now contains data
from A1:C30. I would like to use a macro to add the new data to the chart.
Can someone help me with the code please? Note, that column A always has a
week commencing date in it. So in February, cells A31, A32, A33, etc contain
the date 00-Jan-00 and cells A1:A30 contain proper dates.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Macros To Update Charts

You can do this without using macros. Any of the following links can show
you how.

http://office.microsoft.com/en-us/as...098011033.aspx
http://peltiertech.com/Excel/Charts/Dynamics.html
http://www.tushar-mehta.com/excel/ne...ynamic_charts/


Regards,
Vic Eldridge



"Thriller" wrote:

Hi

I have a spreadsheet with 15 charts. Every month new rows of data are added
to the worksheets. I have to update the charts to contain all the previous
data as well as any new data that is added to the worksheet.

e.g. In January, I have Sheet1 with data from A1:C15. I have the chart that
contains this data. Then in February, Sheet1 is updated and now contains data
from A1:C30. I would like to use a macro to add the new data to the chart.
Can someone help me with the code please? Note, that column A always has a
week commencing date in it. So in February, cells A31, A32, A33, etc contain
the date 00-Jan-00 and cells A1:A30 contain proper dates.

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
link excel charts to web pages and update charts automatically Signguy Charts and Charting in Excel 1 April 22nd 08 08:29 PM
Update Charts Mike D. Excel Discussion (Misc queries) 2 July 13th 07 06:46 PM
Update charts hong Charts and Charting in Excel 0 October 13th 06 08:12 PM
How do I update charts using macros Seng Charts and Charting in Excel 3 November 29th 05 06:02 PM
Charts won't update pwermuth Charts and Charting in Excel 8 July 15th 05 07:32 PM


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