次のコード行に問題があります。
'payFreq is input of type "Long"
Dim DF As Variant
'discFact here is input of type "Range"
DF = discFact.Value
Dim Payment_pay() As Double
ReDim Payment_pay(1 To UBound(DF))
Dim i As Long
'Fill with zeros
For i = 1 To UBound(Payment_pay)
Payment_pay(i) = 0
Next i
Dim Prev_date As Date
Dim Next_date As Date
For i = 1 To UBound(Payment_pay)
Prev_date = makeDate((i - payFreq_pay) & "M")
Next_date = makeDate(i & "M")
Next i
'Continuation of code...
makeDate 関数は基本的に
Function makeDate(Term As String) As Date
...
End Function
変数 Prev_date または Next_date を出力しようとしてもうまくいきません! ただし、上限ループ境界 ( UBound(Payment_pay ) を 6 などに交換すると、期待される戻り値 (正しい日付...) が得られます。ループ イテレータ "i" に何か問題があるようです。
助けていただければ幸いです。
前もってありがとう、ニクラス