Macro for moving all rows down and the bottom row to the top and vice versa

Squiggles17

New Member
Joined
Nov 3, 2013
Messages
5
For example, if cells A1:C28 have data in them, then I want to move cells A1:C27 down one row and move cells A28:C28 back up to the top. I also want a separate macro that will move cells A2:C28 up one row and move cells A1:C1 down to the bottom.

I need it to work for any amount of rows I have. So if I had 195 rows it would do the same thing.
If there is data in columns A and B then that would count as the bottom row. Column C does not need to have anything in it.

Any help is appreciated, Thanks.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
1st code:

Sub DT()

Rows(1).Select
Selection.Insert Shift:=xlDown
Range("A65536").End(xlUp).EntireRow.Select
Selection.Cut
Rows(1).Select
ActiveSheet.Paste
Range("A1").Select

End Sub

2nd code:

Sub TD()

Rows(1).Select
Selection.Cut
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Rows(1).Select
Selection.Delete Shift:=xlUp
Range("A1").Select

End Sub

Hope this helps.

Regards,
Mohan
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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