MACRO for pie chart

dsequeira

New Member
Joined
Mar 14, 2019
Messages
1
Hey guys keep getting an error msg of object variable or with block variable not set..excel highlighted the string of code that may be giving me the issue I a completely stumped need help!
the code is below..any help is appreciated

Sub Macro5()

'
' Macro5 Macro
'
' Keyboard Shortcut: Ctrl+e
'
Dim cht As ChartObject
For Each cht In Worksheets(1).ChartObjects
Next cht
cht.Chart.ChartType = xlPie
Range("D29:N29").Select
ActiveChart.SetSourceData Source:=Range("Sheet1!$D$29:$N$39")
ActiveSheet.Shapes("Chart 1").IncrementLeft 225
ActiveSheet.Shapes("Chart 1").IncrementTop -189
ActiveSheet.Shapes("Chart 1").ScaleWidth 0.9354166667, msoFalse, _
msoScaleFromBottomRight
ActiveSheet.Shapes("Chart 1").ScaleHeight 0.8993055556, msoFalse, _
msoScaleFromTopLeft
ActiveChart.SetSourceData Source:=Range( _
"Sheet1!$D$29:$N$29,Sheet1!$D$39:$N$39")
Range("O8").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.FullSeriesCollection(1).Select
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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