Excel VBA: Find the Next Visible Row After Filtering
Question details
Select the first visible cell below the active cell in a filtered Excel range using VBA.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user is working in a filtered worksheet and wants a macro to move past hidden rows.
- Observed behavior
- The macro should select the next visible cell below the active row within the specified range.
Apply the filter and make sure column A is visible. The example searches through row 25 and assumes the active cell is in column A; adjust the range and column check for your worksheet.
Use SpecialCells to Select the Next Visible Cell
Use this macro to search a defined range and skip rows hidden by a filter.
The macro checks visible cells in A1:A25 and selects the first one below the active cell. It also handles the case where no later visible cell exists.
In Excel, open Developer > Visual Basic, then choose Insert > Module.
Paste this code into the module: Sub NextVisibleRow() Dim visibleCells As Range Dim cell As Range Dim currentRow As Long If ActiveCell.Column <> 1 Then MsgBox "Select a cell in column A first." Exit Sub End If currentRow = ActiveCell.Row On Error Resume Next Set visibleCells = Range("A1:A25").SpecialCells(xlCellTypeVisible) On Error GoTo 0 If Not visibleCells Is Nothing Then For Each cell In visibleCells.Cells If cell.Row > currentRow Then cell.Select Exit Sub End If Next cell End If MsgBox "No visible cell was found below the active row in A1:A25." End Sub
Save the workbook as an Excel Macro-Enabled Workbook (.xlsm). Select a cell in column A, then use Developer > Macros to run NextVisibleRow.
Find Visible Rows with VBA in WPS Spreadsheets
In a WPS Spreadsheets installation that supports VBA, add and run the same macro to select the next visible cell in a filtered range. VBA availability and compatibility depend on your WPS edition and configuration.
- 1. Open the workbook: Open your workbook in WPS Spreadsheets and apply a filter to the data.
- 2. Check VBA availability: Look for Developer > Visual Basic. If it is unavailable, check whether your WPS edition supports VBA and whether its VBA component is installed.
- 3. Insert the macro: In the VBA editor, choose Insert > Module and paste the NextVisibleRow macro from the solution above.
- 4. Run and test: Save the workbook in XLSM format, select a cell in column A, and use Developer > Macros to run NextVisibleRow.

Frequently Asked Questions
Does SpecialCells skip filtered-out rows?
Yes. Range.SpecialCells(xlCellTypeVisible) returns visible cells, excluding cells in hidden rows or columns.
What happens if there is no visible cell below the active row?
The example macro displays a message and leaves the selection unchanged when it finds no later visible cell in A1:A25.
How do I search a different column or range?
Change Range("A1:A25") to your desired range and update the ActiveCell.Column check to its column number. For example, use 2 for column B.
Why can't I find the Developer tab in Excel?
Open File > Options > Customize Ribbon and select Developer under the main tabs. The tab provides access to Visual Basic and Macros.




