logo
search
VBA & Macro Problems

How to Move to the Next Number in a Filtered Excel Column Using VBA

Maira MehtabMaira Mehtab Sep 28, 2026 869 views

Question details

The user needs a reliable method or macro to jump to the next visible item number in a filtered column where the numerical values are not sequential.

How to Move to the Next Number in a Filtered Excel Column
Product
Excel
Device & OS
not provided
Scenario
Reviewing or navigating through a large dataset where a filter has been applied, leaving non-sequential item numbers visible (e.g., jumping from 2040 directly to 2067).
Observed behavior
Standard macro navigation often selects the next physical row even if it is hidden by the filter, rather than jumping to the next visible number in the sequence.
Before you start

Ensure your workbook is saved as a Macro-Enabled Workbook (.xlsm) and always test new VBA scripts on a sample copy of your data before applying them to your main file.

Solution 1Recommended

Use a VBA Macro to Select the Next Visible Cell

Create a custom VBA script that loops through the column to find and select the next unhidden row in a filtered dataset.

By default, basic offset commands in VBA will select hidden rows. To prevent this, the macro must explicitly check if a row is hidden before moving the selection to it. Creating a loop that checks the 'EntireRow.Hidden' property is the most reliable way to navigate non-sequential filtered data.

1
Open the VBA Editor

In your open workbook, press Alt + F11 on your keyboard to launch the Visual Basic for Applications (VBA) editor window.

2
Insert a New Module

Click on 'Insert' in the top menu bar, then select 'Module' to open a new blank coding window for your script.

3
Write the Navigation Loop

Enter a VBA script that uses a 'Do While' loop starting from the ActiveCell. The script should use 'ActiveCell.Offset(1, 0).Select' to move down one row at a time, checking 'If ActiveCell.EntireRow.Hidden = False' to stop when it finds a visible row.

4
Assign and Run the Macro

Close the VBA editor. Back in your worksheet, go to the Developer tab, click 'Macros' (or press Alt + F8), select your new macro, and click 'Options' to assign it a convenient keyboard shortcut for rapid navigation.

Use a VBA Macro to Select the Next Visible Cell
Use Representative Dummy Data: If you are asking a developer to write this specific script for you on a forum, it is highly recommended to upload a test workbook containing dummy data mimicking your exact column layout and filter conditions.

Run Macros and Manage Filtered Lists with WPS Spreadsheet

WPS Spreadsheet provides robust support for VBA and macros, allowing you to easily automate complex navigation tasks in filtered lists. It is highly compatible with Microsoft Excel's macro-enabled files, so you can run your existing scripts seamlessly.

  1. 1. Open your macro-enabled file: Launch WPS Spreadsheet and open your existing .xlsm workbook containing your filtered data.
  2. 2. Enable macros: Click 'Enable Macros' if prompted by the security warning at the top of the worksheet to allow script execution.
  3. 3. Access the Developer tools: Navigate to the 'Developer' tab in the top ribbon and click on the 'VBA Editor' icon to view or insert your navigation script.
  4. 4. Run the script: Apply your filters to the data column, then run your macro via a custom button or shortcut to instantly jump to the next visible non-sequential number.
Full support for Excel VBA macros and .xlsm file formatsAdvanced data filtering and sorting capabilitiesLightweight architecture for fast performance on large datasetsFamiliar interface for quick and easy macro management
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro select hidden rows in a filtered list?

By default, VBA's Offset method moves to the next physical row in the spreadsheet, regardless of whether it is hidden by a filter. To skip hidden rows, your code must explicitly use the SpecialCells(xlCellTypeVisible) method or check the row's Hidden property within a loop.

Can I navigate to the next visible cell without writing VBA code?

Yes, for simple manual navigation in a properly auto-filtered range, using the standard Down Arrow key will typically skip over hidden rows in modern spreadsheet applications. However, if you are recording a macro, the action may translate to an absolute cell reference instead of dynamic visible navigation.

Are Excel VBA macros compatible with WPS Office?

Yes, WPS Office provides excellent compatibility with Microsoft Excel macros. You can open, edit, and execute .xlsm files and VBA scripts directly within WPS Spreadsheet without needing to rewrite your code.