I am receiving an "unable to get the log property of the worksheet function class" error on the line immediately below. I've traced the error back to the construction of "TempSample". When I hover my mouse pointer over counter variables "oo" and "rr" I read "36" which is outside of the range used in constructing the array variables. NumObs reads "35". I am not sure how the counter variable came to read "36" when the loop range is "1 to NumObs (35)". Any ideas? Thanks!
Code:
ArrTemp(nn) = Application.WorksheetFunction.Log(Application.WorksheetFunction.Index(TempSample, nn, 2), Application.WorksheetFunction.Index(TempSample, NumObs, 2))
Code:
Dim ii As Integer: ii = 1 'total sample lengthDim oo As Integer: oo = 1
Dim nn As Integer: nn = 1
Dim rr As Integer: rr = 1
Dim jj As Integer: jj = 5
Dim gg As Integer: gg = 1
'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
'X Log transform X array X
'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
For oo = 1 To NumObs
ArrX(oo) = Application.WorksheetFunction.Log(Application.WorksheetFunction.Index(X, oo, 2), Application.WorksheetFunction.Index(X, NumObs, 2))
Next oo
'XXXXXXXXXXXXXXXX
'X Main Script X
'XXXXXXXXXXXXXXXX
For ii = NumObs To A - NumObs
For rr = 1 To NumObs
TempSample(rr, 1) = Application.WorksheetFunction.Index(PriceData, ii + rr, 1) 'Dimension 1 TempSample - Date of Temp Sample
TempSample(rr, 2) = Application.WorksheetFunction.Index(PriceData, ii + rr, 2) 'Dimension 2 TempSample - price of Temp Sample
TempSample(rr, 3) = Application.WorksheetFunction.Index(PriceData, ii + rr, 3) 'Dimension 3 TempSample - Volume
Next rr
For nn = 1 To NumObs
ArrTemp(nn) = Application.WorksheetFunction.Log(Application.WorksheetFunction.Index(TempSample, nn, 2), Application.WorksheetFunction.Index(TempSample, NumObs, 2))