Macro To Replicate Chart on All Sheets of Workbook

dominicdb

New Member
Joined
Jul 15, 2013
Messages
6
Here's my challenge:

I have 100 sheets in my workbook that are all identical in layout but contain unique information within each sheet, all based on the same parameters. I've got cells in B14:B18 that contain label information (Earnings by Outlet) and cells in F14:18 that contain numeric (financial) information.

I'm looking to create a pie chart on each sheet in the workbook containing the data from those sheets through a macro. I also am hoping to automate the sizing and positioning of these charts within each sheet. Any ideas? Here's what I have so far:

Sub Pie_Chart()
'
' Pie_Chart Macro
' Makes pie chart from Earnings By Outlet Data.
'
' Keyboard Shortcut: Option+Cmd+Shift+P
'
Range("H24").Select
Range("B14:B18,F14:F18").Select
Range("F14").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Range( _
"'Sheet1'!$B$14:$B$18,'Sheet1'!$F$14:$F$18")
ActiveChart.ApplyLayout (4)
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 20
ActiveChart.ClearToMatchStyle
ActiveSheet.Shapes("Chart 9").IncrementLeft -306.4
ActiveSheet.Shapes("Chart 9").IncrementTop 93.6
ActiveSheet.Shapes("Chart 9").ScaleWidth 1.2577777778, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 9").ScaleHeight 0.8333333333, msoFalse, _
msoScaleFromTopLeft
Range("J28").Select
End Sub


 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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