G
giovipi
Apparently in an excel2007 macro the instruction:
dblXIRR = WorksheetFunction.Xirr(strValues, varDates)
does not work properly if varDates has a date element with day>12.
The little test sub below works but if you change any of the days to be > 12
you get a
"Runtime error 1004"
"Unable to get the XIRR property of the WorksheetFunction class"
Same error is reported if you want to use the WorksheetFunction.Xirr with
only two payments and respective dates.
Any suggestion on how to solve the problem (without writing the data in a
sheet and use the xirr on the sheet)?
Thanks
Giovanni
'*********************************************
Sub testxirr()
Dim myStrPrezzoNetto() As String
Dim myVarDate(2) As Variant
myStrPrezzoNetto = Split("-1789.7956 -4292.6008 5623.2", " ")
myVarDate(0) = CDate("11/03/2008")
myVarDate(1) = CDate("11/03/2009")
myVarDate(2) = CDate("11/06/2010")
dblXIRR = WorksheetFunction.Xirr(myStrPrezzoNetto, myVarDate)
End Sub
'**********************************************
dblXIRR = WorksheetFunction.Xirr(strValues, varDates)
does not work properly if varDates has a date element with day>12.
The little test sub below works but if you change any of the days to be > 12
you get a
"Runtime error 1004"
"Unable to get the XIRR property of the WorksheetFunction class"
Same error is reported if you want to use the WorksheetFunction.Xirr with
only two payments and respective dates.
Any suggestion on how to solve the problem (without writing the data in a
sheet and use the xirr on the sheet)?
Thanks
Giovanni
'*********************************************
Sub testxirr()
Dim myStrPrezzoNetto() As String
Dim myVarDate(2) As Variant
myStrPrezzoNetto = Split("-1789.7956 -4292.6008 5623.2", " ")
myVarDate(0) = CDate("11/03/2008")
myVarDate(1) = CDate("11/03/2009")
myVarDate(2) = CDate("11/06/2010")
dblXIRR = WorksheetFunction.Xirr(myStrPrezzoNetto, myVarDate)
End Sub
'**********************************************