for loop - For-looping issue VBA -
i having trouble following line of code.
'payfreq input of type "long" dim df variant 'discfact here input of type "range" df = discfact.value dim payment_pay() double redim payment_pay(1 ubound(df)) dim long 'fill zeros = 1 ubound(payment_pay) payment_pay(i) = 0 next dim prev_date date dim next_date date = 1 ubound(payment_pay) prev_date = makedate((i - payfreq_pay) & "m") next_date = makedate(i & "m") next 'continuation of code... the makedate function basically
function makedate(term string) date ... end function trying output variable prev_date or next_date won't work! however, interchanging upper loop bound ( ubound(payment_pay ) e.g. 6, give expected return value (a correct date...). seems wrong looping iterator "i".
help appreciated!
thanks in advance, niklas
try this
for = 1 ubound(payment_pay) prev_date = makedate(format(i - payfreq_pay) & "m") next_date = makedate(format(i) & "m") next
Comments
Post a Comment