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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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