I have a global variable which shows as a Variant/Variant(1 to 33, 1 to 9) in the Locals window. It's a 2D array.
When I try to for each over the array I cannot access the whole array, only the cell values.
Public myRows As Variant
Public myTable As ListObject
Sub SendEmails()
Dim X As Long
Dim Row As Variant
SetMyTable
For Each Row In myRows
Debug.Print CheckRow(Row)
Next Row
End Sub
Function CheckRow(Row As Variant) As Boolean
Dim IsRowValid As Boolean
IsRowValid = True
If IsEmpty(Row(1)) = True Then
IsRowValid = False
End If
If IsEmpty(Row(2)) = True Then
IsRowValid = False
End If
If IsEmpty(Row(3)) = True Then
IsRowValid = False
End If
If IsEmpty(Row(4)) = True Then
IsRowValid = False
End If
If IsEmpty(Row(5)) = True Then
IsRowValid = False
End If
CheckRow = IsRowValid
End Function
I am trying to call the CheckRow function where the input parameter should be a row (array of cell values). I checked the input in Debug and it's only one cell value not an array of cell values.
I want to check all the 33 rows, 1 by 1.
For...Each, the order in this particular case will bemyRows(1, 1), myRows(1, 2)... myRows(33, 8), myRows(33, 9). Not much to do with rows. Could you explain in more detail what you are trying to print? Also, please share the code of theCheckRowfunction because it possibly doesn't do what you expect it should do.False, otherwiseTrue, in the Immediate window?