'How to get the Lenght of argument declarated as a variant
Function MyPV(CF As Variant, PositiveR As Double, NegativeR As Double)
Dim n
Dim i, soma
soma = 0
For i = 1 To n
If CF(i) > 0 Then
soma = soma + CF(i) / (1 + PositiveR) ^ i
ElseIf CF(i) < 0 Then
soma = soma + CF(i) / (1 + NegativeR) ^ i
Else
MyPV = "ERRO"
End If
Next i
MyPV = soma
End Function
In this code, I have to select the Cashflows and then return the present value. The book I'm using suggests doing CF as a Variant, but I can't get the value of its length. How can I do it?
I know that excel in English "," is used to separate the parameters of a function, but in Portuguese is ";"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
