Determining row # of selected cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,

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
 
Mike - Thanks!


Mike H said:
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
 

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