ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   XNPV Function (https://www.excelbanter.com/excel-worksheet-functions/240278-xnpv-function.html)

David

XNPV Function
 
I'm using Excel 2007 and I'm trying to calculate XNPV for a certain
array within VBA. Within Excel, the XNPV function asks for 3
arguments: XNPV(rate,value,dates), but within VBA, it is only asking
for 2 arguments. When I looked up XNPV within the Excel Help, it says
the function calls for 2 arguments, but gives an example with 3. When
trying to use three arguments I get a compile error with this message:
"Wrong number of arguments or invalid property assignment" I know it
is not an invalid property assignment because I am using the XIRR
function (which only requires 2 arguments) with the same arrays.
Anyone have a solution? Here is code:

Range("H50") = WorksheetFunction.Xirr(NetCFAC, DateSet()) -- THIS
WORKED
Range("D49") = WorksheetFunction.Xnpv(0.05, NetCFAC, DateSet()) --
THIS DOES NOT WORK

Thanks


All times are GMT +1. The time now is 06:04 AM.

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