biocentrism
Board Regular
- Joined
- Jul 28, 2014
- Messages
- 187
Hello
I get a run-time error 1004: Unable to get the StDev_S property of the WorksheetFunction class on the code below:
I have checked the code and the underlying sheet and there does not seem to be anything wrong. In fact the code runs when I step through the program in debug mode using F8.
How can the line generate an error when the macro is run, but work successfully when stepping through in debug mode using F8?
Any ideas?
Thank you.
I get a run-time error 1004: Unable to get the StDev_S property of the WorksheetFunction class on the code below:
Code:
'Define Start Row and End Row of Ranges
StartRow = rowTemplateFirst + loopRowsTemplate - DaysOffset
EndRow = rowTemplateFirst + loopRowsTemplate - 1
Set rngStDevRange = Range(Cells(StartRow, colReturn), Cells(EndRow, colReturn))
'Build Array
arrFV(loopRowsTemplate - 1) = Application.WorksheetFunction.StDev_S(rngStDevRange) * Sqr(252)
I have checked the code and the underlying sheet and there does not seem to be anything wrong. In fact the code runs when I step through the program in debug mode using F8.
How can the line generate an error when the macro is run, but work successfully when stepping through in debug mode using F8?
Any ideas?
Thank you.