Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to get the address of active cell in Excel?

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


Combine multiple worksheets/workbooks into one worksheet / workbook:

Combine multiple worksheets or workbooks into one single worksheet or workbook may be a huge task in your daily work. But, if you have Kutools for Excel, its powerful utility – Combine can help you quickly combine multiple worksheets, workbooks into one worksheet or workbook. Download the full feature 60-day free trail of Kutools for Excel now!

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download the free trial Now!


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. Copy and paste the formula =ADDRESS(ROW(),COLUMN()) into the cell and then press the Enter key.

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


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:


Office Tab - Tabbed Browsing, Editing, and Managing of Workbooks in Excel:

Office Tab brings the tabbed interface as seen in web browsers such as Google Chrome, Internet Explorer new versions and Firefox to Microsoft Excel. It will be a time-saving tool and irreplaceble in your work. See below demo:

Click for free trial of Office Tab!

Office Tab for Excel


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    RichEO · 5 days ago
    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.
  • To post as a guest, your comment is unpublished.
    Bill Schipper · 1 years ago
    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
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      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