Skip to main content

How to get the address of active cell in Excel?

Author: Siluvia Last Modified: 2020-04-26

While using the Microsoft Excel, you can easily get the location of currently selected cell in the Name Box which lists on the left of the Formula Bar. But if the cell is named, you can’t examine its location based on the displaying on the Name Box. And if you want to directly show the full address of the active cell, or display the address of active cell in a specified cell, what would you do? In this tutorial, we will show you how to easily get the address of the active cell with formula and VBA methods.

Get address of active cell with Formula
Get address of active cell with VBA code
Display the address of active cell in a specified cell with VBA code
Dynamically display the address of active cell with an amazing tool


Get address of active cell with Formula

In this section, we will provide you a formula of easily getting the address of active cell.

1. Select a cell to make it active.

2. Enter the below formula into it and then press the Enter key.

=ADDRESS(ROW(),COLUMN())

Then you can see the address of the current selected cell is displaying in the cell immediately.

Note: If you go to select a different cell, the address would not change automatically. For getting a dynamic address while selecting different cells, please apply the below methods.

Dynamically display the address of active cell:

The Enhanced Edit Bar utility of Kutools for Excel helps to display the address of active cell dynamically in worksheet in Excel. Besides, you can view and edit the seleced cell content directly in the window as the below demo shown.
Download and try it now! (30-day free trail)


Get address of active cell with VBA code

You can also get the address of active cell with VBA code. Please do as follows.

1. Press the Alt + F11 simultaneously to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, double click the name of current using worksheet in the left pane to open the Code editor, then copy and paste the below VBA code into the Code editor.

VBA code: Get address of active cell

Sub selectRange()
	MsgBox ActiveCell.Address
End Sub

3. Then click the Run button to run the code.

4. Then a dialog box will pop up with the address of the active cell listed inside.


Display the address of active cell in a specified cell with VBA code

In another situation, you would like the address of active cell be displayed in a specified cell. Every time when you move from one cell to another, the cell address will be automatically changed and displayed in the specified cell. Please do as follows.

1. Please open the Microsoft Visual Basic for Applications window by pressing Alt + F11 at the same time.

2. Double click the sheet name in the left pane to open the code editor, then copy and paste the below code into it.

VBA code: display the address of active cell in a specified cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
	Range("A1").Value = ActiveCell.Address
End Sub

Note: A1 is the cell where you want to put the active cell address, you can change it to the specified cell for your own needs.

3. Then click File > Close and Return to Microsoft Excel to exit the Microsoft Visual Basic for Applications window.

You can see the address of active cell displays on the cell A1, and the address will change automatically based on the changing of the active cell. See screenshot:


Dynamically display the address of active cell with an amazing tool

If you want to dynamically display the address of active cell in worksheet, I highly recommend the Enhanced Edit Bar tool of Kutools for Excel. Let's see how this tool can dynamically display the address of active cell in worksheet.

Before applying Kutools for Excel, please download and install it firstly.

1. Click Kutools > Show & Hide > Enhanced Edit Bar to enable the feature.

From now on, every time you click a cell, the Enhanced Edit Bar window will pop up. And the address of the ative cell will be displayed on the bottom of the window.
Tips: You can directly view and edit the cell content directly in the window.

  If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.


Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bom dia,
Excelente formula para exibir a célula ativa.
Mas estou precisando utilizar o "conteúdo" de uma célula ativa dentro de uma formula SE.
Entao:

Se
"celula_ativa" = "aluno"
Retorna a seguinte informação "XXXX"
OU se for "professor"
Retorna a seguinte informação "YYYY"

Vc consegue me ajudar com isso, por favor?
This comment was minimized by the moderator on the site
I am fairly new to writing VBA.
Instead of reporting the message box with activated cell address, I would like to pull the cell address of an activated cell from my vba code and store it in a table/other location on the sheet for each iteration that my for loop takes.

How would I go about completing this task?


Regards,
This comment was minimized by the moderator on the site
The first example does not display the address of the active cell but of the cell containing the formula. If you were to select a different cell the address would not change.
Actually this is probably more useful information than gathering the active cell's address and harder to find if you need it. I was looking how to do this using VBA and could not find it for a while so I will include it here:

Application.Caller.Address

That will give you the address of the cell calling the function and not the active cell, useful for relative references.
This comment was minimized by the moderator on the site
Hello,

Displaying the active cell reference is helpful. But how do I actually use that value? I'm reading exams, and have six columns (of which two will get filled in). The student name is in column A; I can extract the family name: LEFT(A7,(FIND(",")A7)-1))) [where A7 is the current address]. I can use the code for displaying the current active cell address provided above:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = ActiveCell.Address
End Sub

But what I really want to do is have the cursor being somewhere in the current row (C3:H3), and extract the family name of the current student. Example:

A B C D E F G H
1 Name ID 1 2 3 4 5 6

2 Smith, John 1234567

When the active cell is between C1 and H1, I want to extract the student name from A2 ("Smith, John") [using LEFT(A2,(FIND(",")A2)-1)))], but with the values for the address supplied from the code above.

Any suggestions would be welcome.


Bill
This comment was minimized by the moderator on the site
Dear Bill,
If you want to use the cell reference of active cell, please apply below VBA code.
(The active cell reference will be displayed in cell A1. Then you can copy the cell reference directely in A1 or do other operations as you need.)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If (Target.Count = 1) And (Intersect(Target, Range("A1")) Is Nothing) Then
Range("A1").Value = ActiveCell.Address
End If
End Sub
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations