ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting source data (https://www.excelbanter.com/excel-programming/345611-re-setting-source-data.html)

Nigel

setting source data
 
The simplest answer would be .......

ActiveChart.SetSourceData Source:=myNewSheet.myF _
, PlotBy:=xlColumns

but I suspect your range myF is not just the range for the chart data? If
it is then all well and good.

--
Cheers
Nigel



"cjsmith22" wrote
in message ...

cheers nigel - couple of problems though - i recorded a macro to set up
a chart and i got the following code:

Code:
--------------------
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Update

8").Range("O19:O38,A19:A38") _
, PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="Update 8"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
--------------------

As the name of the sheet will change every month (update 8 to update
9,10,11 etc) but it will always be the last sheet in the book, i set
'update 8' to the variable 'mynewSheet' ( Set mynewSheet =
myWorkbook.Worksheets(sCount) ) *also* , the range from where the data
is taken ("O19:O38,A19:A38") will also change every month so i set up
the variable 'myF'(a range in mynewSheet) (the data will always be in
columns O and A of 'myF') - how do i incorporate these two into
SetSourceData ?


--
cjsmith22
------------------------------------------------------------------------
cjsmith22's Profile:

http://www.excelforum.com/member.php...o&userid=28528
View this thread: http://www.excelforum.com/showthread...hreadid=484925





All times are GMT +1. The time now is 05:14 PM.

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