ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to paste row number in cell (https://www.excelbanter.com/excel-programming/365640-macro-paste-row-number-cell.html)

leonidas[_26_]

Macro to paste row number in cell
 

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


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426


Kevin B

Macro to paste row number in cell
 
Try this:

Sub PostRow()

Dim MyRow As Long

MyRow = ActiveCell.Row
ActiveSheet.Next.Select
Range("H32").Select
ActiveCell.Value = myrow
End Sub

--
Kevin Backmann


"leonidas" wrote:


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


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426



Duncan[_5_]

Macro to paste row number in cell
 
myrow = ActiveCell.row
Range("h32").Value = myrow


Duncan


leonidas wrote:

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


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426



Don Guillett

Macro to paste row number in cell
 
range("H32")=activecell.row

--
Don Guillett
SalesAid Software

"leonidas" wrote in
message ...

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


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:
http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426




Don Guillett

Macro to paste row number in cell
 
hit the button too soon. try
Sub test()
ActiveSheet.Next.Range("h3") = ActiveCell.Row
End Sub


--
Don Guillett
SalesAid Software

"leonidas" wrote in
message ...

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


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:
http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426




leonidas[_27_]

Macro to paste row number in cell
 

Hi,

Thank you all for your help!
All solutions are working perfect!


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426


Don Guillett

Macro to paste row number in cell
 
except that mine did not involve selections.

--
Don Guillett
SalesAid Software

"leonidas" wrote in
message ...

Hi,

Thank you all for your help!
All solutions are working perfect!


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:
http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426




Duncan[_5_]

Macro to paste row number in cell
 
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

Don Guillett wrote:

except that mine did not involve selections.

--
Don Guillett
SalesAid Software

"leonidas" wrote in
message ...

Hi,

Thank you all for your help!
All solutions are working perfect!


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:
http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=556426




All times are GMT +1. The time now is 12:29 AM.

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