ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to obtain the number of Column and Row from selected (active)cell? (https://www.excelbanter.com/excel-programming/347349-how-obtain-number-column-row-selected-active-cell.html)

And1

How to obtain the number of Column and Row from selected (active)cell?
 
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

Brian

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

rowId = Range(ActiveCell.Address).Row
colId = Range(ActiveCell.Address).Column




"And1" wrote in message
...
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




[email protected]

How to obtain the number of Column and Row from selected (active) cell?
 
Sub y()
Range("A1") = Selection.Row
Range("A2") = Selection.Column
End Sub

On Mon, 05 Dec 2005 17:48:04 +0100, And1 wrote:

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



And1

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

Regards,
Andrzej


All times are GMT +1. The time now is 05:17 AM.

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