0

I have a query.

Can i get a cell id of the active cell in excel.

Suppose my current active cell by cursor is A6 , in some particlar cell , say A1 it should say A6.

Next time when i keep cursor on A10, value in the above particular cell A1 should automatically change to A10.

Awaiting for your kind reply.

2 Answers2

1

You can use any from following approaches:

1) you can create an UDF

Function getActiveCellAddr() As String
    Application.Volatile True
    getActiveCellAddr = ActiveCell.Address
End Function

and then call it in A1 cell: =getActiveCellAddr()

2) you can use Worksheet_SelectionChange event in the Sheet module

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

this code changes content of A1 each time new cell is selected.

Note: Both approaches works with cells in single sheet.

Dmitry Pavliv
  • 35,333
  • 13
  • 79
  • 80
0

Try this macro in Selection change Event

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells(1, 1).Value = ActiveCell.Address
End Sub