Macro error bars on bar graphs

spill-the-beans

Board Regular
Joined
Feb 7, 2013
Messages
52
Hello all,

I'm trying to make a macro that creates my graphs for me, and part of this is adding custom error bars to each bar. I recorded a macro as a basis, and the relevant code it gives me is below. In my worksheet, I have custom standard errors already calculated on row 19 from columns B to F. The errors will always be in these cells across the graphs I want the macro for, but when I run the macro excel recorded for me, it cannot run the code it just created, saying there is and object variable not set, and I think that might be the range.

Is there a way to add in to the macro the range B19:F19 where I want it to look for the custom error values? Any help on this would be appreciated.

Sub test()
'


ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).HasErrorBars = True
ActiveChart.SeriesCollection(1).ErrorBars.Select
ActiveChart.SeriesCollection(1).ErrorBar Direction:=xlY, Include:=xlBoth, _
Type:=xlCustom, Amount:=0
Application.CutCopyMode = False
ActiveChart.SeriesCollection(1).ErrorBars.Select
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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