I'm using the following code, this works great as it picks data up from the Cmonth sheet and makes a copy of this on the archive sheet.
It currently copies rows with an entry in and places it on the last blank row of the archive sheet.
Normally this would be sorted to put the newest copied data to the top.
However i'm being told that there is a need to run this once a month for a year.
The range to be copied each month could be from 25 to 45 rows. That would mean to have the newest copied data at the top would mean potentially sorting over 500 rows.
Is there a way to modify the macro below to place the copied range at the top thus removing the need to sort each month.
I've searched and tried to mod for two days now with no success. If anyone can point me in the wright direction please do!
Sub Cmonth_data_to_archive()
Dim PLimit As Long, ALimit As Long
Dim P As Long
PLimit = Sheets("Cmonth").Cells(Rows.Count, 13).End(xlUp).Row
Application.ScreenUpdating = False
Sheets("archive").Visible = xlSheetVisible
ALimit = Sheets("archive").Cells(Rows.Count, 1).End(xlUp).Row + 1
For P = PLimit To 1 Step -1
If Sheets("Cmonth").Cells(P, 1) > "0" Then
Sheets("Cmonth").Range("A" & P & ":R" & P).Copy
Sheets("archive").Range("A" & ALimit & ":M" & ALimit).PasteSpecial (xlValues)
ALimit = ALimit + 1
End If
Next P
'Sheets("archive").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
Application.CutCopyMode = False
MsgBox "" & vbCrLf & vbCrLf & vbCrLf & "updated:" & vbCrLf & "All records processed." & vbCrLf & " ", vbInformation, "Completed:"
End Sub
Many thanks for taking the time to read the above.
Bookmarks