Iterate over a possibly empty array in VBA (Excel)
When you try to iterate over an empty array in VBA like this, you will get a runtime error (index out of bounds): Sub ArrayTest() Dim testarray() As Integer Dim i As Integer For i = LBound(testarray) To UBound(testarray) ‘ 1 Then ‘ 1 Then If Err.Number = 0 Then …
