I am using this code which works but I am getting a lot of empty lines at the end of the array: ary
Is there a way to resize ary array inside the loop to avoid the extra blank lines not met by the conditions?
Dim myTable As ListObject
Dim myArray As Variant
Dim ary As Variant
Dim x As Long
Dim r As Long, nr As Long
Set myTable = x_sheet.ListObjects("accounts_table")
myArray = myTable.DataBodyRange
ReDim ary(1 To UBound(myArray), 1 To 2)
For x = LBound(myArray) To UBound(myArray)
If myArray(x, 5) = "On" Then
If myArray(x, 4) <> "T" Or myArray(x, 4) <> "I" Then
nr = nr + 1
ary(nr, 1) = myArray(x, 1)
ary(nr, 2) = myArray(x, 2)
End If
End If
Next x