ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Update Chart Source (w/macro?) (https://www.excelbanter.com/excel-worksheet-functions/62963-update-chart-source-w-macro.html)

tx12345

Update Chart Source (w/macro?)
 

Hi,

It seems when a chart is created in Excel, even if you have '#N/A's in
the column, if you have 10 numbers plus, let's say 10 #N/As, you'll get
a chart that shows 20 spaces worth of dta.

However, the source for the chart changes. One day is might be:
=main!$G$8:$G$12, and the next =main!$G$8:$G$115, and the next
=main!$G$8:$G$75, etc. I want to use the same chart, and not have any
extranneaous spce on the right. If thee are 10 entires, I only want to
see 10 entries on the chart, etc.

The only solution I have for the moment is very inelegant, which is to
create a chart each time with a macro using this code:


Code:
--------------------

Dim w As String
w = Cells(6, 15)
Range(w).Select
Charts.Add

--------------------


where the macro reads from the little 'dim' statement on what range to
draw from to *create* the chart. But after fiddling around for a few
hours, I could not figure out how to get the 'dim' statement to
*revise* the chart.

Any ideas?

TIA!!!


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=497783



All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com