View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
losmac losmac is offline
external usenet poster
 
Posts: 27
Default How to get the active cell address?

Try it!

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim celAdr As String
Dim lRow As Long, pos As Long, i As Long

celAdr = Target.Address
lRow = Target.Row + 1

Do
pos = InStr(pos + 1, celAdr, "$")
If pos 0 Then i = pos

Loop Until pos = 0

MsgBox Left(celAdr, i) & lRow

End Sub

losmac

Uzytkownik "d" napisal w wiadomosci
...
How to get the active cell address?
eg. Click A1 on Excel sheet1 and VBA code get this active
cell value "A1" and display in A2 cell.

Thanks in advance.

d