ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to customize error bars by VB code? (https://www.excelbanter.com/excel-programming/330540-how-customize-error-bars-vbulletin-code.html)

[email protected]

How to customize error bars by VB code?
 
Hello NG,


from a Visual Basic (6) project, I need to customize the error bar of a

chart, to get a different value for each data point.


In Excel, this is done with a range reference:


ActiveChart.SeriesCollection(1*).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=Hoja1!R1C3:R2C3"


but I need to do this by VB code, in order to control a OLE-Chart.
Reference to the datasheet-range is not working:


oGraph.SeriesCollection(1).Err*orBar Direction:=xlY, Include:=xlBoth,
_
Type:=xlCustom, Amount:=oGraph.Application.Dat*aSheet.Range("A1:A3 ")



Any ideas?


Thanks in advance (and sorry for crossposting)


Miguel


George Nicholson[_2_]

How to customize error bars by VB code?
 
Amount:="=Hoja1!R1C3:R2C3"
is a text string (which works)

Amount:=oGraph.Application.Dat*aSheet.Range("A1:A3 ")
is an range object (which doesn't work)

therefore, try passing it a string (aircode):
Amount:= "=" & oGraph.Application.Dat*aSheet.Range("A1:A3").Addre ss

--
George Nicholson

Remove 'Junk' from return address.


wrote in message
oups.com...
Hello NG,


from a Visual Basic (6) project, I need to customize the error bar of a

chart, to get a different value for each data point.


In Excel, this is done with a range reference:


ActiveChart.SeriesCollection(1*).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=Hoja1!R1C3:R2C3"


but I need to do this by VB code, in order to control a OLE-Chart.
Reference to the datasheet-range is not working:


oGraph.SeriesCollection(1).Err*orBar Direction:=xlY, Include:=xlBoth,
_
Type:=xlCustom, Amount:=oGraph.Application.Dat*aSheet.Range("A1:A3 ")



Any ideas?


Thanks in advance (and sorry for crossposting)


Miguel



[email protected]

How to customize error bars by VB code?
 
thanks George, but this produced a "Object doesn´t support this
property or method" error.


Tushar Mehta

How to customize error bars by VB code?
 
Do remember to check the responses to your multipost in .charting (and
elsewhere?)

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
Hello NG,


from a Visual Basic (6) project, I need to customize the error bar of a

chart, to get a different value for each data point.


In Excel, this is done with a range reference:


ActiveChart.SeriesCollection(1*).ErrorBar Direction:=xlY, Include:= _
xlPlusValues, Type:=xlCustom, Amount:="=Hoja1!R1C3:R2C3"


but I need to do this by VB code, in order to control a OLE-Chart.
Reference to the datasheet-range is not working:


oGraph.SeriesCollection(1).Err*orBar Direction:=xlY, Include:=xlBoth,
_
Type:=xlCustom, Amount:=oGraph.Application.Dat*aSheet.Range("A1:A3 ")



Any ideas?


Thanks in advance (and sorry for crossposting)


Miguel



[email protected]

How to customize error bars by VB code?
 
thanks Tushar, I do remember

Miguel



All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com