ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Moving the second row with a macro (https://www.excelbanter.com/excel-worksheet-functions/244494-moving-second-row-macro.html)

Max2073

Moving the second row with a macro
 
Hi,

I would like to create a macro that moves the second row to the last row in
a range of rows. eg. range - rows 1:100 (I have data in rows 105:5000)

I can not work out if this is possible or how to do it.




Jacob Skaria

Moving the second row with a macro
 
Try the below..

Sub Macro1()
Dim lngLastRow As Long
lngLastRow = Range("A101").End(xlUp).Row

'OR - to move to last+1 row and shift
Rows(2).Cut
Rows(lngLastRow + 1).Insert Shift:=xlDown

'to move to lastRow+1
'Rows(2).Cut Rows(lngLastRow + 1)

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Max2073" wrote:

Hi,

I would like to create a macro that moves the second row to the last row in
a range of rows. eg. range - rows 1:100 (I have data in rows 105:5000)

I can not work out if this is possible or how to do it.





All times are GMT +1. The time now is 02:52 AM.

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