Skip to content

Instantly share code, notes, and snippets.

@Vitosh
Last active November 25, 2019 11:08
Show Gist options
  • Save Vitosh/576d48073af3d4c469801a423a1997b5 to your computer and use it in GitHub Desktop.
Save Vitosh/576d48073af3d4c469801a423a1997b5 to your computer and use it in GitHub Desktop.
Checks whether there are units in the array.
Option Explicit
Sub TestMe()
Dim errorArray()
Dim checkArray As Integer
Dim errorString As String
Dim c As Range
Dim i As Long: i = 0
Dim myRange As Range
Set myRange = Worksheets(1).Range("A1:E10")
For Each c In myRange
If IsError(c) = True Then
ReDim Preserve errorArray(i)
errorArray(i) = c.Address
i = i + 1
End If
Next c
If Not Not errorArray Then
errorString = "An error(s) occured in following cell(s):" & Chr(10)
For i = 0 To UBound(errorArray)
errorString = errorString & errorArray(i) & Chr(10)
Next
Debug.Print errorString
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment