What I need to do is filter through a table by using the second column from each row from another table. The table that I loop through contains 11 rows and the code loops 11 times, but it uses the 11th row each time. What it needs to do is go from the first row to the last row.
Edit: With help of Variatus I have applied a count
instead of For Each
. This seems to be able to go through all the rows, except the last row. To be continued.
Edit2: for those who are curious, have a look at my follow up question where I got everything to work! Filter a table with an array of criteria derived from another table
Sub LoopDoorAfdelingV4()
Dim myTable As ListObject
Dim myTable2 As ListObject
Dim oRow As ListRow
Dim c As Long
Dim myGroupIDFilter As Variant
Dim myGroupNameFilter As Variant
Set myTable = ActiveSheet.ListObjects("TabelGroupID")
Set myGroupIDFilter = myTable.ListColumns(1).Range
Set myGroupNameFilter = myTable.ListColumns(2).Range
Set myTable2 = ActiveSheet.ListObjects("TabelAfdelingenIntern")
For c = 1 To myTable.ListRows.Count
ActiveSheet.Range(myTable2).AutoFilter Field:=1, Criteria1:=myGroupNameFilter(c), _
Operator:=xlOr
Next c
End Sub