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.
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:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) Range("A1").Value = ActiveCell.Address End Sub
Now, as you move about this single sheet, the contents of A1 should be constantly updated to reflect your location.
Note:
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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
If you create a user form in VBA that includes checkboxes, you may want to make the checkboxes larger. You can't adjust ...
Discover MoreStrings are used quite frequently in macros. You may want to swap the contents of two string variables, and you can do so ...
Discover MoreDo you need to find cells that are formatted with a particular color? How you accomplish this task depends on your ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments