Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Displaying the Selected Cell's Address.

Displaying the Selected Cell's Address

Written by Allen Wyatt (last updated February 29, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


Excel allows you to easily see the location of the currently selected cell by examining the contents of the Name Box, to the left of the Formula Bar. This is fine and good, but there are times when you would like to have the address of a cell actually in a cell. For instance, you may want cell A1 to contain the address of the currently selected cell. This means that if cell E4 were selected, then A1 would contain its address, or $E$4. If you then pressed the right-arrow key, then the contents of A1 would change to $F$4.

In order to return the address of the currently selected cell, you must resort to using macros. The following macro will return the value of the cell selected at the time it is run:

Public Function CurrentCell() As String
    Application.Volatile
    CurrentCell = ActiveCell.Address
End Function

The inclusion of the Application.Volatile method means that every time the worksheet is recalculated, this function (macro) is again run. To use the macro you can place the following in any cell desired, including A1:

=CurrentCell

You should note that this macro doesn't result in the contents of A1 changing every time you move to a different cell. Again, the contents of A1 will change only when the workbook is recalculated, either by changing something in the worksheet or by pressing F9.

If, instead, you need to have a "real time" version that automatically updates A1 as the selected cell is changed, you can follow these steps:

  1. Display the VBA Editor by pressing Alt+F11.
  2. In the Project window, at the left side of the Editor, double-click on the name of the worksheet you are using. (You may need to first open the VBAProject folder, and then open the Microsoft Excel Objects folder under it.)
  3. In the code window for the worksheet, click on the Object drop-down list and choose Worksheet. When you do, the Procedure should change to SelectionChange, and the framework for the event handler should appear in the code window.
  4. Change the event handler so it appears as follows:
  5. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
        Range("A1").Value = ActiveCell.Address
    End Sub
    
  6. Close the VBA Editor.

Now, as you move about this single sheet, the contents of A1 should be constantly updated to reflect your location.

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 (2302) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Displaying the Selected Cell's Address.

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

Better-Looking Full Justification for Paragraphs

If you want Word to justify paragraphs in the same way that it is done in WordPerfect, you'll want to apply the steps in ...

Discover More

Closing Excel when Closing the Last Workbook

Have you noticed that when you close the last workbook in Excel, the program window itself often stays open? This ...

Discover More

Creating Worksheets from a List of Names

Need to create a large number of worksheets using specific names? If so, you'll love the ideas presented in this tip.

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Noting the Workbook Creation Date

You may want to add, to your worksheet, the date on which a particular workbook was created. Excel doesn't provide a way ...

Discover More

Converting Cells to Proper Case

When storing text in a worksheet, you may have a need to change the case of that text so that the initial letter in each ...

Discover More

Determining the Length of a String

Macros are great for working with strings, and one of the most commonly used string functions is Len. This tip explains ...

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 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.