Hello,
i am currently using HoadleyOptions addin but i am struggling to use on of his formulas in vba, don't know if anyone has experience with this but the setup is as follows;
i have 252 daily prices in column A
in cell D1 the result of the following formula should be displayed;
=HoadleyGARCH("V";A1:$A$252;;252;;2)
if i use the formula in excell all works fine but i cant get it to work in vba
hoadley gives following advice with the formula: "Important note: If this function is being called from a VBA module then you must define (or use redim) the number of items in the array to be exactly equal to the number of prices. This principle applies to dividends as well."
right now i have in vba:
Sub Garch()
Dim i As Integer
Dim MyArray()
MyArray = Range("Garch").Value
'check!
For i = LBound(MyArray, 1) To UBound(MyArray, 1)
Range("D1") = HoadleyGarch("V", MyArray, , 252, , 2)
Next i
End Sub
when i run it i get compile error argument not optional.
If anyone has any ideas i would be happy to hear them
thanks
i am currently using HoadleyOptions addin but i am struggling to use on of his formulas in vba, don't know if anyone has experience with this but the setup is as follows;
i have 252 daily prices in column A
in cell D1 the result of the following formula should be displayed;
=HoadleyGARCH("V";A1:$A$252;;252;;2)
if i use the formula in excell all works fine but i cant get it to work in vba
hoadley gives following advice with the formula: "Important note: If this function is being called from a VBA module then you must define (or use redim) the number of items in the array to be exactly equal to the number of prices. This principle applies to dividends as well."
right now i have in vba:
Sub Garch()
Dim i As Integer
Dim MyArray()
MyArray = Range("Garch").Value
'check!
For i = LBound(MyArray, 1) To UBound(MyArray, 1)
Range("D1") = HoadleyGarch("V", MyArray, , 252, , 2)
Next i
End Sub
when i run it i get compile error argument not optional.
If anyone has any ideas i would be happy to hear them
thanks