Growth formula VBA

Joined
May 31, 2012
Messages
1
Reaction score
0
Hello,

I'm trying to get a result from the Growth formula in VBA:
Public Sub GetGrowth()
On Error GoTo errorhandler
Dim dblAnswer As Double
Dim varX As Variant
Dim varY As Integer

Dim xlApp As Object
Dim numGrowth As Double
Set xlApp = CreateObject("Excel.Application")


varX = Array(5, 10, 15, 20, 25)
varY = 6

dblAnswer = xlApp.WorksheetFunction.Growth(varX, , varY)

MsgBox "Answer: " & dblAnswer
Set xlApp = Nothing

errorhandler:
MsgBox "Error " & Err.Description
Set xlApp = Nothing

End Sub

I've tried the Y value as a variant and a string as well ("{6}"). I get error msg 424, "Unable to get the Growth property of the worksheet function class. This happens at the line: dblAnswer = xlApp.WorksheetFunction.Growth(varX, , varY)

Thanks if you can advise how to call this function. When it's finished I'll be sending in the X's and Y's to a function...if I can get the call to the Growth function correct.

eshafer
 
Back
Top