Drop to next visible row when filtered?

E

Ed

I want my macro to enter a formula in a cell, then drop to the next visible
cell one row down when I'm in AutoFilter mode. I tried
ActiveCell.Offset(1, 0).Activate
but that drops it to the next row even if it's hidden by the filter. Can I
put SpecialCells(xlVisible) in here somehow?

Ed
 
J

John Green

Ed,

You can use code like the following:

Dim i As Long

i = 1
With ActiveCell
Do Until .Offset(i).EntireRow.Hidden = False
i = i + 1
Loop
.Offset(i).Select
End With
 
P

pk

Try something like the following:

Do
r = r + 1
If ActiveCell.Offset(r, 0).EntireRow.Hidden = True Then
Else
Exit Do
End If
Loop
ActiveCell.Offset(r, 0).Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top