Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 72
Default error bars in VBA excel 2007 macro

I can't manage Y-error bars as the way it works in Excel 2000 VBA macro.
The macro stops and shows a run-time error 1004 at command;
ActiveChart.SeriesCollection(1).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:=4
What's different in Excel 2007 vs 2000 ?
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default error bars in VBA excel 2007 macro

Hi,

You will need to change your code for xl2007.
If the Amount is fixed, in your case to the value 4, then you will need to
use the correct Type argument rather than custom.
If it is custom then you will need an array of values. And you will need
both plus and minus values even if the minus values are not used.

Sub xx()

Dim objSeries As Series
Dim vntArrayPlus() As Variant
Dim vntArrayMinus() As Variant
Dim lngIndex As Long

With ActiveChart.SeriesCollection(1)
ReDim vntArrayPlus(1 To .Points.Count)
ReDim vntArrayMinus(1 To .Points.Count)
For lngIndex = 1 To .Points.Count
vntArrayPlus(lngIndex) = 4
Next
.ErrorBar Direction:=XlErrorBarDirection.xlY, Include:=xlPlusValues,
_
Type:=xlErrorBarTypeCustom, Amount:=vntArrayPlus,
MinusValues:=vntArrayMinus

.ErrorBar Direction:=XlErrorBarDirection.xlY, Include:=xlPlusValues,
_
Type:=xlErrorBarTypeFixedValue, Amount:=4
End With


End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Roland" wrote in message
...
I can't manage Y-error bars as the way it works in Excel 2000 VBA macro.
The macro stops and shows a run-time error 1004 at command;
ActiveChart.SeriesCollection(1).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:=4
What's different in Excel 2007 vs 2000 ?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Error Bars in Excel 2007 rookie6521 Charts and Charting in Excel 2 September 15th 09 04:37 PM
Adding Error Bars Excel 2007 Lars B Excel Discussion (Misc queries) 8 January 27th 09 11:55 AM
Excel 2007 - Custom error bars ?? mc.linux Charts and Charting in Excel 5 September 6th 08 10:36 PM
Excel 2007 horizontal error bars DickB Charts and Charting in Excel 4 November 20th 07 02:23 AM
Excel 2007 Custom Error Bars BuzzinHornet Excel Discussion (Misc queries) 4 June 14th 06 10:47 PM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"