Macro to cut rows based on NONBLANK cell and append to list in separate worksheet - xl2000

GBhoy

New Member
Joined
Jan 28, 2008
Messages
10
Hi,

I have a worksheet, "Current Week", with a list of all staff in range A8:AA1003.
If a staff member has left in the previous 7 days, a leaving date is entered in column 'N', otherwise it's blank.
I need to remove all records of these 'leavers' (i.e. all records, A:AA, where N is not blank) on a weekly basis and append the records to the bottom of a list in a separate "Leavers Archive" worksheet.

Unfortunately my VBA skills are extremely limited and I don't have the first idea how to achieve this! Any ideas?

Many thanks in advance.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi,

After much pain, I have managed to get this working with the following code:

Sub Archive_Leavers()
Dim LastRowMain As Long
Dim LastRowEntered As Long
Dim i As Long
Application.ScreenUpdating = False
LastRowMain = Worksheets("Current Week").Range("A" & Rows.Count).End(xlUp).Row
With Worksheets("Current Week")
For i = 8 To LastRowMain Step 1
If Cells(i, "n") <> "" Then
LastRowEntered = Worksheets("Leavers Archive").Range("A" & Rows.Count).End(xlUp).Row
Rows(i).Cut Worksheets("Leavers Archive").Range("A" & LastRowEntered + 1)

End If
Next i
End With

Worksheets("Current Week").Select
Application.ScreenUpdating = True

End Sub

Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

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