Navigating through filtered cells

R

Reney Langlois

Hi,
I'd like to step through rows of a column of cells
which are visible due to me setting a filter. I may want
to assign values to empty cells based on the values of
neighboring rows. Since the data is filtered, there may
be many "behind-the-scenes" rows that are not shown to
me. What are the VB navigation commands that I can use to
step my way through each row and reference only the
visible cells immediately above and below cells of
interest?

Thanks much,

Reney
 
A

Andoni

Have a look
Sub Macro2()
Set Rg = Selection.CurrentRegion.SpecialCells(xlCellTypeVisible)
For Each Cell In Rg
If Intersect(Cell.Offset(1, 1), Rg) Is Nothing Then
''''Exit Sub
Else
Cell.Offset(1, 1).Select
End If
Next


End Sub
 
Top