Excel 2013 VBA - Message box with location of my active cell.

brothertruffle880
brothertruffle880 used Ask the Experts™
on
I would like to generate a message box with the current location of active cell.

What is the VBA code I can use to do this?

BT
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
byundtMechanical Engineer
Most Valuable Expert 2013
Top Expert 2013
Commented:
MsgBox ActiveCell.Address(External:= True)        'Includes worksheet and filename
MsgBox ActiveCell.Address                                      '$A$1 style address only

Open in new window

Tom FarrarConsultant

Commented:
I know you said VBA, but you could always look in your name box on the ribbon.
EE.PNG
Hardware Tester and Debugger
Commented:
Hi there! :)

In a formula, it will look like this:
=ADDRESS(ROW(),COLUMN())

Open in new window


But I also understand why you need a VBA, since your cell might need to have other values, formulas or data.

You may refer to the example file: Example.xlsm

Picture1.png
The full code:
Sub ActiveCellInformation()

    MsgBox ("The active/current cell's address is " & ActiveCell.Address & _
    vbNewLine & "The active/current cell's row is row " & ActiveCell.Row & _
    vbNewLine & "The active/current cell's column is column " & Chr(ActiveCell.Column + 64) & " / column number " & ActiveCell.Column & _
    vbNewLine & "The active/current cell's formula is " & ActiveCell.Formula & _
    vbNewLine & "The active/current cell's result/data is " & ActiveCell.Value), 0, "Active Cell Summary"
     
End Sub

Open in new window

Author

Commented:
Thanks so much for providing the code and the insights!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial