ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the active cell address? (https://www.excelbanter.com/excel-programming/275208-how-get-active-cell-address.html)

d

How to get the active cell address?
 
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

losmac

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





All times are GMT +1. The time now is 11:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com