Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default chart error bars

Has anyone had success with creating custom error bars in Excel 2007 from VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default chart error bars

How odd. It works fine but only if you do it like this

On Error Resume Next
' set the error bars
On Error Goto 0

Maybe one for Andy Pope !

Regards,
Peter T

"Paula Galloway" wrote in message
...
Has anyone had success with creating custom error bars in Excel 2007 from
VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default chart error bars

As I mentioned, the code worked for me under 'on error resume next'. However
to get it to work without forcing, it seems need to supply both error bars,
even if the minus are not required.

Set sr = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
sr.ErrorBar Direction:=xlY, _
Include:=xlBoth, _
Type:=xlCustom, _
Amount:="=Sheet1!R2C17:R4C17", _
MinusValues:="={0}"

Could also do
Amount:=Range("$Q$2:$Q$4")

Note, in the above, chart, series index and sheet name changed from your
original.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
How odd. It works fine but only if you do it like this

On Error Resume Next
' set the error bars
On Error Goto 0

Maybe one for Andy Pope !

Regards,
Peter T

"Paula Galloway" wrote in
message ...
Has anyone had success with creating custom error bars in Excel 2007 from
VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default chart error bars

Peter -

You were right. Andy figured this one out for me some time ago, and it's now
part of my bag of tricks.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Peter T" <peter_t@discussions wrote in message
...
As I mentioned, the code worked for me under 'on error resume next'.
However to get it to work without forcing, it seems need to supply both
error bars, even if the minus are not required.

Set sr = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
sr.ErrorBar Direction:=xlY, _
Include:=xlBoth, _
Type:=xlCustom, _
Amount:="=Sheet1!R2C17:R4C17", _
MinusValues:="={0}"

Could also do
Amount:=Range("$Q$2:$Q$4")

Note, in the above, chart, series index and sheet name changed from your
original.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
How odd. It works fine but only if you do it like this

On Error Resume Next
' set the error bars
On Error Goto 0

Maybe one for Andy Pope !

Regards,
Peter T

"Paula Galloway" wrote in
message ...
Has anyone had success with creating custom error bars in Excel 2007
from VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default chart error bars

Andy figured this one out for me some time ago

I should have guessed :-)

Regards,
Peter T


"Jon Peltier" wrote in message
...
Peter -

You were right. Andy figured this one out for me some time ago, and it's
now part of my bag of tricks.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Peter T" <peter_t@discussions wrote in message
...
As I mentioned, the code worked for me under 'on error resume next'.
However to get it to work without forcing, it seems need to supply both
error bars, even if the minus are not required.

Set sr = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
sr.ErrorBar Direction:=xlY, _
Include:=xlBoth, _
Type:=xlCustom, _
Amount:="=Sheet1!R2C17:R4C17", _
MinusValues:="={0}"

Could also do
Amount:=Range("$Q$2:$Q$4")

Note, in the above, chart, series index and sheet name changed from your
original.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
How odd. It works fine but only if you do it like this

On Error Resume Next
' set the error bars
On Error Goto 0

Maybe one for Andy Pope !

Regards,
Peter T

"Paula Galloway" wrote in
message ...
Has anyone had success with creating custom error bars in Excel 2007
from VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default chart error bars

Thanks!

"Peter T" wrote:

Andy figured this one out for me some time ago


I should have guessed :-)

Regards,
Peter T


"Jon Peltier" wrote in message
...
Peter -

You were right. Andy figured this one out for me some time ago, and it's
now part of my bag of tricks.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Peter T" <peter_t@discussions wrote in message
...
As I mentioned, the code worked for me under 'on error resume next'.
However to get it to work without forcing, it seems need to supply both
error bars, even if the minus are not required.

Set sr = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
sr.ErrorBar Direction:=xlY, _
Include:=xlBoth, _
Type:=xlCustom, _
Amount:="=Sheet1!R2C17:R4C17", _
MinusValues:="={0}"

Could also do
Amount:=Range("$Q$2:$Q$4")

Note, in the above, chart, series index and sheet name changed from your
original.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
How odd. It works fine but only if you do it like this

On Error Resume Next
' set the error bars
On Error Goto 0

Maybe one for Andy Pope !

Regards,
Peter T

"Paula Galloway" wrote in
message ...
Has anyone had success with creating custom error bars in Excel 2007
from VBA?

In prior versions I was able to do so with

ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=MySheet!R2C17:R4C17"

When I try that code in 2007 I get error 1004, Application-defined or
object-defined error.









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
how to add error bars into bar chart John Smith[_8_] Charts and Charting in Excel 0 December 6th 11 07:35 PM
Customise error bars on individual bars in a bar chart 2007 Millie Charts and Charting in Excel 2 April 25th 09 04:16 AM
How to add error bars to 3-D chart Shijia Excel Discussion (Misc queries) 2 November 20th 07 09:48 PM
Trendline for chart with error bars Amy Charts and Charting in Excel 2 August 28th 07 02:48 AM
Colouring error bars in a chart Graham Whitehead Excel Programming 1 August 4th 06 02:59 PM


All times are GMT +1. The time now is 12:49 PM.

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"