VBA Loop Visible Cells

VBA to loop the visible cells only.  Used for when you filter a table and then want to check the visible cells only.

‘Loop visible Rows

Set Rng = ActiveSheet.UsedRange
For Each cl In Rng.SpecialCells(xlCellTypeVisible).Rows
MsgBox Cells(cl.Row, cl.Column).Value & cl.Row
Next cl

 

‘Loop all visible cells

Set Rng = ActiveSheet.UsedRange
For Each cl In Rng.SpecialCells(xlCellTypeVisible)
MsgBox Cells(cl.Row, cl.Column).Value & cl.Row
Next cl