Excel VBA 1004 Error!!!

bobbyzulauf

New Member
Joined
May 21, 2015
Messages
2
First time poster having trouble finding resolution with a Macro I created. I have tested this macro on multiple computers, Mac Excel 2011, PC Excel 2007, 2010, and 2013.

For some reason , when one user attempts to run this macro on their PC using Office 2011, they receive a Run Time 1004 Error Application-defined or object defined error. Basically the Macro stops before the first chart could be created. The other computer that I tested using the same exact Office version does not have this problem. The debugger opens up to the error occuring on the Active.Sheet.Shapes.AddChart.Select line.

Like I said, this macro works on multiple computers and I have no clue what I should do next.

Here is a snippet of the code

Range("B2").Select
Selection.Font.Bold = True
Range("B20:B36,E20:E36").Select
Range("E20").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Range( _
"Analysis!$B$20:$B$36,Analysis!$E$20:$E$36")
ActiveChart.ApplyLayout (4)
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
First time poster having trouble finding resolution with a Macro I created. I have tested this macro on multiple computers, Mac Excel 2011, PC Excel 2007, 2010, and 2013.

For some reason , when one user attempts to run this macro on their PC using Office 2011, they receive a Run Time 1004 Error Application-defined or object defined error. Basically the Macro stops before the first chart could be created. The other computer that I tested using the same exact Office version does not have this problem. The debugger opens up to the error occuring on the Active.Sheet.Shapes.AddChart.Select line.

Like I said, this macro works on multiple computers and I have no clue what I should do next.

Here is a snippet of the code

Range("B2").Select
Selection.Font.Bold = True
Range("B20:B36,E20:E36").Select
Range("E20").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Range( _
"Analysis!$B$20:$B$36,Analysis!$E$20:$E$36")
ActiveChart.ApplyLayout (4)
Remove the '.Select' and see if that cures it. The chart should automatically be selected when it is added.
 
Upvote 0
No Luck...removing ".Select" will first create a Bar Graph and then the chart is not selected to modify it to a Pie Chart. I confirmed this on my computer in which the Macro already works on.

First time poster having trouble finding resolution with a Macro I created. I have tested this macro on multiple computers, Mac Excel 2011, PC Excel 2007, 2010, and 2013.

For some reason , when one user attempts to run this macro on their PC using Office 2011, they receive a Run Time 1004 Error Application-defined or object defined error. Basically the Macro stops before the first chart could be created. The other computer that I tested using the same exact Office version does not have this problem. The debugger opens up to the error occuring on the Active.Sheet.Shapes.AddChart.Select line.

Like I said, this macro works on multiple computers and I have no clue what I should do next.

Here is a snippet of the code

Range("B2").Select
Selection.Font.Bold = True
Range("B20:B36,E20:E36").Select
Range("E20").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Range( _
"Analysis!$B$20:$B$36,Analysis!$E$20:$E$36")
ActiveChart.ApplyLayout (4)
 
Upvote 0

Forum statistics

Threads
1,203,044
Messages
6,053,186
Members
444,643
Latest member
Shipwreck818

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