Reputation: 101
I am working with tables in Excel (ListObject). I apply filter via VBA on a table which work fine. I would like to read specific row (or row, col) from filtered table. I tried with SpecialCells which return a range of cells. But I would like to iterate as rows like listobject.listrows(N) where n is number of row. I didn't find any example. Of course I can iterate cell by cell and locate the the row via formula. But I wonder if exist a better way.
For instance: I would like filter a table with several criteria and update certain columns with a particular value.
I hope I am clear with my question. thanks.
Upvotes: 1
Views: 1002
Reputation: 84465
You can loop rows like this
Option Explicit
Sub test()
Dim rng As Range
With ActiveSheet.ListObjects(1).DataBodyRange
For Each rng In .SpecialCells(xlCellTypeVisible).Rows
Debug.Print rng.Address
Next rng
End With
End Sub
Upvotes: 0