Changing source data in graph

RichardMGreen

Well-known Member
Joined
Feb 20, 2006
Messages
2,177
Hi all

Is it possible to use a macro to change the source data references of a chart?
I only want to change the sheet name as the cell references themselves will be identical.

Any help with coding would be greatly appreciated.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Richard,

Have a look here to see if it helps.

Sub Macro2()
'
' Macro2 Macro
'

'
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet4").Range("A1:F9")
Range("L5").Select
End Sub
 
Last edited:
Upvote 0
Thanks Trevor.

I'm looking to do more of a replacement of sheet names if at all possible.
I can supply the original sheet name and the sheet name it will become, I'm just struggling with the replacement bit.
 
Upvote 0
Hi Trevor, thanks for that.
I'm looking to do more of a find/replace type thing on the sheet names if possible?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,718
Members
452,939
Latest member
WCrawford

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