Archive Macro That I can Assign to a button

Malissa1578

New Member
Joined
Mar 14, 2013
Messages
10
I am not very good with Macro and have been trying to use the record macro and then edit for a selectable range to create an archive button that I can then select my row.

What I want to do is hit an archive button that will archive a row that I select from the active sheet to my "archive" sheet in my workbook. Can someone help me create that generic macro?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi Malissa,

Something like this what your after?

Code:
Sub Archive()

Dim Rng As Range
Dim ArcStrt As Long
Dim ArcEnd As Long
Dim LastRw As Long

Set Rng = Application.InputBox("Please select a range to archive", "Archive", Type:=8)

ArcStrt = Rng.Row
ArcEnd = Rng.Row + Rng.Rows.Count - 1

LastRw = Sheets("Archive").Range("A" & Rows.Count).End(xlUp).Row

Rows(ArcStrt & ":" & ArcEnd).Copy Sheets("Archive").Range("A" & LastRw + 1)

Rows(ArcStrt & ":" & ArcEnd).Delete

End Sub

Hope this helps,
Cheers,
Alan.
 
Upvote 0

Forum statistics

Threads
1,217,382
Messages
6,136,240
Members
450,000
Latest member
jgp19

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