trying to code XIRR with a variable range. Most examples use standard ranges, not variable, e.g. rmax for final row. Data:
1/1/2009 -7558.00 (row 7)
1/2/2010 204.12 columns "A" and "O" respectively
1/3/2011 9937.15
1/4/2012 601.38 (row 10)
Sub projectYield()
Dim values As Range, dates As Range, est As Integer, rmax As Integer
rmax = 11: est = 18 'final transaction row, yield estimate
Set values = Range("o7:o" & CStr(rmax))
Set dates = Range("a7:a" & CStr(rmax))
Cells(1, 1).Value = WorksheetFunction.Xirr(values, dates, est) '[a1] as %
End Sub
run-time error '1004' : unable to get the Xirr property of the worksheetFunction class
-----------------------------------------------------------------------------------------------
been at this on and off for weeks now, coding several different ways, with/without ranges.
i fear this is something very basic that I'm missing. Code is in a VBA module, not in worksheet
module, but also does not work when code is in the worksheet mod. Any ideas?? Thanks.
Bookmarks