VBA & Macro Problems

How to Use VBA End(xlDown) to Find the Bottom of an Excel List

Nimra MalikNimra Malik Nov 10, 2026 868 views

Question details

The user wants to write an Excel VBA macro that finds the last contiguous cell at the bottom of a data list using the End(xlDown) method.

How to Use VBA End(xlDown) to Find the Bottom of an Excel List
Product
Excel
Device & OS
Windows 11
Scenario
Navigating to the bottom of a continuous data range dynamically within a VBA macro script to automate data selection.
Observed behavior
A VBA script is needed to automate finding the last cell in a column before a blank row appears, simulating the Ctrl + Down Arrow shortcut.
Before you start

Ensure you have enabled the Developer tab in your spreadsheet application and saved your file as a Macro-Enabled Workbook (.xlsm) to allow VBA code execution.

Solution 1Recommended

Use the Range.End(xlDown) Method in VBA

This is the standard VBA method to jump to the last non-empty cell in a contiguous column of data, similar to pressing Ctrl + Down Arrow on your keyboard.

The End(xlDown) method simulates the keyboard shortcut Ctrl + Down Arrow. It is highly effective for continuous datasets, but note that it will stop at the very first blank cell it encounters in the column.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) Editor.

2
Insert a New Module

In the top menu, click 'Insert' and select 'Module' to create a blank canvas for your code.

3
Declare Your Variables

Define your range variables to store the first and last cells. Type: Dim FirstCell As Range, LastCell As Range.

4
Set the Starting Cell

Assign your starting position. For example, to start at A1, type: Set FirstCell = Range("A1"). Ensure the range is qualified with the correct worksheet if necessary.

5
Apply End(xlDown)

Use the End method to find the bottom of the list. Type: Set LastCell = FirstCell.End(xlDown).

6
Select the Found Cell

To actively select the bottom cell in your worksheet, add this line at the end: LastCell.Select.

Use the Range.End(xlDown) Method in VBA
Watch Out for Blank Cells: If there are blank cells within your list, xlDown will stop at the cell right above the first blank, not the absolute bottom of the worksheet.
Powerful VBA Support in WPS Office

Run Your Excel VBA Macros Seamlessly in WPS Spreadsheet

WPS Spreadsheet offers robust built-in support for VBA and Macros, allowing you to run your End(xlDown) scripts just like you do in Microsoft Excel. It is a highly compatible and lightweight alternative for your data automation tasks.

  1. 1. Download and Install WPS Office: Download WPS Office for free and open your .xlsm file in WPS Spreadsheet.
  2. 2. Access the VBA Editor: Go to the 'Developer' tab on the ribbon and click on 'VBA Editor'.
  3. 3. Insert Your Macro: Paste or write your End(xlDown) macro code into a new module.
  4. 4. Run Your Script: Click 'Run' or press F5 to execute your macro and instantly find the bottom of your data list.
Fully compatible with Microsoft Excel VBA syntax and objectsSupports .xlsm and .xlsb macro-enabled file formats nativelyBuilt-in VBA editor for writing, editing, and debugging macrosLightweight architecture ensures fast execution of large data scripts
microsoft office alternative - wps office

Frequently Asked Questions

Why does End(xlDown) stop before the actual bottom of my data?

The xlDown method stops at the very first empty cell it encounters. If your data column contains blank cells in the middle of the list, the script interprets the cell above the blank as the bottom of the contiguous range.

How can I find the last cell if my column has blank rows?

Instead of using End(xlDown) from the top, use End(xlUp) starting from the very bottom of the worksheet. For example, use 'Cells(Rows.Count, 1).End(xlUp)'. This will find the last used cell in column 1 (A) regardless of gaps above it.

Does this VBA code work on Windows 11?

Yes, standard Excel VBA methods like Range.End(xlDown) are entirely independent of the operating system version and are fully compatible with Windows 11 across supported versions of Excel and WPS Office.

How do I select the entire range from the starting cell to the bottom?

You can define and select the entire block by combining both the first and last cell variables. Once you have defined FirstCell and LastCell, simply use the code: Range(FirstCell, LastCell).Select.