I have code that searches a worksheet for errors and puts the cell address and the error on a separate sheet.
Set RErrors = Nothing
On Error Resume Next
Set RErrors = Sheets("Sheet1").ListObjects("Table").Range.SpecialCells(xlCellTypeFormulas, 16)
On Error GoTo 0
Counter = 0
If Not RErrors Is Nothing Then
Workbooks(Different_Workbook).Sheets(Different_Sheet).Activate
For Each x In RErrors
ActiveSheet.Range("A1").Offset(Counter, 0).Formula = x.Address
ActiveSheet.Range("B1").Offset(Counter, 0) = x
x.ClearContents
Counter = Counter + 1
Next x
End If
The code is working but I am planning to fill all the error cell address and corresponding errors in a 2D array, and present a pivoted view for each type of error and the number of cells.
I am facing two problems--
How do I initialize the array when I don't know the number of errors (and without Dim, I can't fill)? Perhaps it would mean to run a loop to first find all errors then get the sum of errors and then Dim and then again a loop to fill the error array, so two loops for one thing?
How do I manipulate the error (and position) filled array to get a result which shows how many cells each type of error has (like a pivot)?