I'm working on debugging a macro for a colleague of mine and I was not the original writer of the code. That being said, the issue was created when excel updated, causing the macro to become defective - Application-defined or Object-defined error (ERROR '1004')
Here is a look at the specific portion of code:
Next n_counter
'calculate aggregated results
For counter_res = 1 To 7
'insert variance of null distribution
Worksheets("results").Cells(22 + counter_res, 2).Value = _
Worksheets("L_S_2008").Cells(2 + counter_res, no_anchors).Value
'mean values of agreement index
Worksheets("results").Cells(22 + counter_res, 3).Value = _
WorksheetFunction.Average(Range(Cells(3, 18 + counter_res), _
Cells(5000, 18 + counter_res)))
'SD of agreement index
Worksheets("results").Cells(22 + counter_res, 4).Value = _
(WorksheetFunction.Var(Range(Cells(3, 18 + counter_res), _
Cells(5000, 18 + counter_res)))) ^ 0.5
'P25 of agreement index
Worksheets("results").Cells(22 + counter_res, 6).Value = _
WorksheetFunction.Percentile(Range(Cells(3, 18 + counter_res), _
Cells(5000, 18 + counter_res)), 0.25)
'Median (P50) of agreement index
Worksheets("results").Cells(22 + counter_res, 7).Value = _
WorksheetFunction.Percentile(Range(Cells(3, 18 + counter_res), _
Cells(5000, 18 + counter_res)), 0.5)
'P25 of agreement index
Worksheets("results").Cells(22 + counter_res, 8).Value = _
WorksheetFunction.Percentile(Range(Cells(3, 18 + counter_res), _
Cells(5000, 18 + counter_res)), 0.75)
Debugging returned the very first line of code
[Worksheets("results").Cells(22 + counter_res, 2).Value = Worksheets("L_S_2008").Cells(2 + counter_res, no_anchors).Value]
as the source of the error.
If anyone has some feedback or advice, I would be greatly honored. Thank you in advance for taking a look at the problem, it is much appreciated.