Updating charts using Named ranges

ZaneCOYS

New Member
Joined
Nov 23, 2010
Messages
24
Hi all,

So i have managed this before but can not get it today.

I have a named range Chart_Updater and this contains the details of the data rows for charts,

Code:
Chart_Updater = Worksheets("Sorts").Range("Chart_Updater")
For i = 1 To 1
x = thismonth
Set SourceSheet = Worksheets("Data")
XDatarow = 1

Set MyChartXData = SourceSheet.Range(Cells(XDatarow, thismonth), Cells(XDatarow, thismonth - 11))

'Define values for each chart
Select Case Chart_Updater(i, 5)

Case 1
seriesnum = Chart_Updater(i, 4) ' the amount of series for each chart
datarow = Chart_Updater(i, 2) ' the row on the data sheet the data for the chart can be found

Set DestSheet = Worksheets(Chart_Updater(i, 3))' the sheet the chart is on
End Select

Set MyChart = DestSheet.ChartObjects("Chart " & Chart_Updater(i, 1)) ' each cart is named Chart 104 ect this picks up the cart name.

For j = datarow To seriesnum + datarow
SourceSheet.Activate
Set MyChartData = SourceSheet.Range(Cells(datarow, x), Cells(datarow, x - 11))
MyChart.Activate
ActiveChart.SeriesCollection(j).Values = MyChartData
Next j
Next i
Code:

So this code does not seem to be gathering the data and updating. It might be that I have completely messed this up so any advise would be very welcome.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Code:
For j = 1 To seriesnum
SourceSheet.Activate
Set MyChartData = SourceSheet.Range(Cells(datarow, x), Cells(datarow, x - 11))
MyChart.Activate
ActiveChart.SeriesCollection(j).Values = MyChartData
Next j
Next i
[Code]
So simple yet so confusinh
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top