Identify Cell location in VBA

J

James Stricklen

Hello, I'm trying to identify the current cell location using code. For example, the active cell is A1. I was looking for some code which would take the active cell and store it in a variable. Any help would be appreciated.

James
 
J

John Wilson

James,

Try this:

Sub TestMe()
Dim MyRange As String
MyRange = ActiveCell.Address
MsgBox MyRange
End Sub

John

James Stricklen said:
Hello, I'm trying to identify the current cell location using code. For
example, the active cell is A1. I was looking for some code which would
take the active cell and store it in a variable. Any help would be
appreciated.
 
R

Rob van Gelder

James,

Sub test()
Dim rng As Range

Set rng = ActiveCell
Debug.Print rng.Address
End Sub

Rob


James Stricklen said:
Hello, I'm trying to identify the current cell location using code. For
example, the active cell is A1. I was looking for some code which would
take the active cell and store it in a variable. Any help would be
appreciated.
 
Top