An implementation of Visual Basic that is built into Microsoft products.
Hi @Albert Kremer ,
If you need to determine the position of the currently selected cell in Excel VBA, the ActiveCell object provides access to both its coordinates and worksheet reference.
Dim rowNumber As Long
Dim columnNumber As Long
rowNumber = ActiveCell.Row
columnNumber = ActiveCell.Column
You can also retrieve the cell address if you need a worksheet reference in addition to the numeric row and column values:
MsgBox "Cell Address: " & ActiveCell.Address & vbCrLf & _
"Row: " & ActiveCell.Row & vbCrLf & _
"Column: " & ActiveCell.Column
For example, when cell D7 is selected:
- ActiveCell.Address returns $D$7
- ActiveCell.Row returns 7
- ActiveCell.Column returns 4
The Address property can be useful when logging, reporting, or displaying the currently selected cell, as it provides the familiar worksheet reference rather than only numeric coordinates.
I hope this helps.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.