Cut/paste last 36 rows and move to a new worksheet

mnh

New Member
Joined
Mar 22, 2024
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello - newbie here. Using VBA, I need to cut the last 36 rows of data and paste them to a new sheet. The actual number of rows will vary each time we use the sheet.

Any help would be greatly appreciated!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi, welcome to the forum,

would this help ?

VBA Code:
Sub remove_rows()

Dim rownums, lastrow As Long

rownums = Application.InputBox("How Many Rows to Delete ?", "Enter No. of Rows to Remove", "0", , , , , 1)
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row  'checks to find last rowcontaining data in ColA.

row_range = "A" & lastrow - rownums + 1 & ":" & "A" & lastrow

Range(row_range).EntireRow.Delete

End Sub
 
Upvote 1
Solution
Great, glad we could be of assistance for you.

Thanks for the feedback.

Rob
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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
Back
Top