Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Selecting the First Cell In a Row.

Selecting the First Cell In a Row

Written by Allen Wyatt (last updated April 6, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


3

If you need to select the first cell in a row from within your macro, you can do it with the Select method, as follows:

Cells(ActiveWindow.RangeSelection.Row, 1).Select

Once executed, the selected cell becomes the first cell (in column A) of the current row. If you run this line while a range of cells is selected, then the cell in column A of the first row of the selection is selected.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7602) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Selecting the First Cell In a Row.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Saving WordArt Graphics as Files

WordArt can be a handy tool for creating all sorts of flourishes on traditional text. If you want to save the graphic ...

Discover More

Automatic AutoCorrect Exceptions for Beginning Sentences

When automatically capitalizing the beginning of sentences, Word relies on how you historically have done your typing. ...

Discover More

Controlling the Printer in a Macro

Need to access the advanced capabilities of a printer from within an Excel macro? You may be out of luck, unless you ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Adjusting a Path Based on System and User

It is not uncommon to set variables in a macro based on other values, such as time or date. You could also set variables ...

Discover More

DOS from Macros

Need to run a DOS command from within one of your macros? The answer is the Shell command, described in this tip.

Discover More

Resetting Default Names for New Worksheets

When you add a new worksheet to a workbook, Excel gives it a default name that consists of "Sheet" followed by a number. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 4?

2022-04-07 04:36:30

Rick Rothstein

@RKeev,

You changed the problem from the one Allen proposed. He wanted the selection to move to Column A on the same row as the ActiveCell whereas your code selects the next (downward) visible cell within the same column as the ActiveCell. Given that, your function does not need to be that "complex"... you can do what your code does with a single line of code...

Range(ActiveCell.Offset(1), Cells(Rows.Count, ActiveCell.Column)).SpecialCells(xlVisible)(1).Select


2022-04-06 09:46:52

RKeev

What if there are hidden rows?
This selects the next visible cell from the active cell
Sub NextVisible()
Dim r As Range
Set r = ActiveCell
For i = 1 To Rows.Count
Set r = r.Offset(1, 0)
If r.EntireRow.Hidden = False Then
r.Select
Exit Sub
End If
Next
End Sub


2022-04-06 04:32:11

Rick Rothstein

Another way to do this...

ActiveCell.EntireRow.Cells(1).Select


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.