Cut and Move from Row 2 to Final Row

anniemay

Board Regular
Joined
May 31, 2012
Messages
180
I need to cut and move data in a worksheet where the bottom always changes. The header row should stay in worksheet 1 and row 2 down to the bottom needs to be cut and moved to worksheet 2. One time it could be 100 rows and the next time a thousand or more.

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,179
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Hi annimay
Didn't know where you wanted it pasted in Sheet 2 so I assumed in row 2
Code:
Sub movem()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Rows("2:" & lr).Cut Destination:=Sheets("Sheet2").Rows("2:2")
End Sub
 

anniemay

Board Regular
Joined
May 31, 2012
Messages
180
Hi annimay
Didn't know where you wanted it pasted in Sheet 2 so I assumed in row 2
Code:
Sub movem()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Rows("2:" & lr).Cut Destination:=Sheets("Sheet2").Rows("2:2")
End Sub

Thanks. I did not think to state that. It would be where the last row ends in the worksheet 2, which will also grow each time as that is where the rows are saved.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,179
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Try
Code:
Sub movem()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
lr2 = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row
Rows("2:" & lr).Cut Destination:=Sheets("Sheet2").Rows(lr2 + 1)
End Sub
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,179
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Glad it worked, and thanks for the feedback....(y)
 

Watch MrExcel Video

Forum statistics

Threads
1,130,110
Messages
5,640,147
Members
417,127
Latest member
shakilk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top