scroll through visible rows only

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,074
Office Version
  1. 2019
Platform
  1. Windows
I'm using this code to scroll through each row, however if the rows are filtered I would like to scroll through only the visible rows. Can someone assist with a vba code to only scroll through the visible rows. Thanks

VBA Code:
Private Sub spNav_SpinDown()
Dim LRow As Long

LRow = Application.Max(7, Range("A" & Rows.Count).End(xlUp).Row)

If Range("A7") > vbNullString Then Cells(Application.Min(LRow, selection.Row + 1), "A").Select
end sub
 
Hi Mark....

How do I stop it from passing the first filtered row? I don't want it to pass Row 7
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
If you always have some visible data and your headers are in row 1 then try

VBA Code:
Sub Option1()
    Dim i As Long

    For i = ActiveCell.Row - 1 To Range("A2:A" & ActiveCell.Row).SpecialCells(xlVisible)(1).Row Step -1
        If Rows(i).Hidden = False Then
            Cells(i, ActiveCell.Column).Select
            Exit For
        End If
    Next i
End Sub
 
Last edited:
Upvote 1

Forum statistics

Threads
1,214,569
Messages
6,120,286
Members
448,953
Latest member
Dutchie_1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top