Sorry if the question is stupid since I'm new to VBA.
The problem arises in the beginning since an excel IRR cannot calculate a changing column in a simulation(only calculates the initial values not the values in the following loops). So I went for the VBA IRR function, but the double array requirement of it seems to be another major problem.
When I try to read range into a variant array, and somehow convert each array element to double type, and then use them in VBA IRR function, the code still shows "type mismatch". I have tried in arrays too, but the same result of error.
Is there a way to make worksheet IRR work with changing cells, or to convert a variant array to a double which makes VBA IRR work?
Here is the code:
Dim va As Variant
Dim va_d As Double
va = Worksheets(3).Range("AY16:AY136").Value
va_d = CDbl(va)
Worksheets(3).Range("H7").Value = IRR(va_d)