ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining row # of selected cell (https://www.excelbanter.com/excel-programming/398084-determining-row-selected-cell.html)

Bob

Determining row # of selected cell
 
I need to determine and then store the row number of the cell that has been
selected in the active workbook. Later, after running some additional code,
I need to select the cell in column A using the row number that was stored in
the first step.

Can someone kindly show me how to do this? Thanks in advance for the help.

Mike H

Determining row # of selected cell
 
Bob,

Try this

Sub getrow()
myAddress = ActiveCell.Row

'write row number to A1 (Change to suit)
Sheets("Sheet1").Cells(1, 1).Value = myAddress
'run some other code

'Get row number from A1 on sheet 1
Cells(Sheets("Sheet1").Cells(1, 1).Value, 1).Select
End Sub

Mike

"Bob" wrote:

I need to determine and then store the row number of the cell that has been
selected in the active workbook. Later, after running some additional code,
I need to select the cell in column A using the row number that was stored in
the first step.

Can someone kindly show me how to do this? Thanks in advance for the help.


Bob

Determining row # of selected cell
 
Mike - Thanks!


"Mike H" wrote:

Bob,

Try this

Sub getrow()
myAddress = ActiveCell.Row

'write row number to A1 (Change to suit)
Sheets("Sheet1").Cells(1, 1).Value = myAddress
'run some other code

'Get row number from A1 on sheet 1
Cells(Sheets("Sheet1").Cells(1, 1).Value, 1).Select
End Sub

Mike

"Bob" wrote:

I need to determine and then store the row number of the cell that has been
selected in the active workbook. Later, after running some additional code,
I need to select the cell in column A using the row number that was stored in
the first step.

Can someone kindly show me how to do this? Thanks in advance for the help.



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

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