Macro to paste row number in cell

  • Thread starter Thread starter leonidas
  • Start date Start date
L

leonidas

Hi,

I have the following macro. How do I paste the rownumber in cell H32?

Sub test()

myrow = ActiveCell.Row
ActiveSheet.Next.Select
Range("H32").Select

End Sub
 
Try this:

Sub PostRow()

Dim MyRow As Long

MyRow = ActiveCell.Row
ActiveSheet.Next.Select
Range("H32").Select
ActiveCell.Value = myrow
End Sub
 
hit the button too soon. try
Sub test()
ActiveSheet.Next.Range("h3") = ActiveCell.Row
End Sub
 
I agree Don,

Yours definately thought outside of the box and provided a complete
solution removing the need to select which is more efficient.

I did not pay attention to that bit myself, but then I am also still
learning.

Duncan
 

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