How to obtain the number of Column and Row from selected (active)cell?

  • Thread starter Thread starter And1
  • Start date Start date
A

And1

Maybe this stupid, but it will add me in sure project.

For example, select mouse any cell, and
I want, to :

Cells("A1").Value = Row
Cells("A2").Value = Col
' dim Row, Col as Integer
but,
Row = ???? (I don't know)
Col = ???? (I don't know)

Regards,
Andrzej
 
Try

rowId = Range(ActiveCell.Address).Row
colId = Range(ActiveCell.Address).Column
 
Sub y()
Range("A1") = Selection.Row
Range("A2") = Selection.Column
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top