Hello,
I've got a working sheet, and attempting to run a script that checks for items that are old and can be sent to an archive sheet.
"ArchiveCopy" is the working sheet, and "ArchivePaste" is where I want the information copied to. I want the script to look down G:G and check if it says "Wait" or "OK" - OK is good to copy over information in the row.
Part of the problem I'm running into is that I want it to copy a range if it finds an entry, from A:G, but not an entire row because there is information to the right of G that needs to stay.
This is what I have so far, but it also copied the header over to the new sheet. Can anyone help steer me on this one?
In the end, I want the script to also delete the information from ArchiveCopy, but I thought I would tackle one problem at a time.
I've got a working sheet, and attempting to run a script that checks for items that are old and can be sent to an archive sheet.
"ArchiveCopy" is the working sheet, and "ArchivePaste" is where I want the information copied to. I want the script to look down G:G and check if it says "Wait" or "OK" - OK is good to copy over information in the row.
Part of the problem I'm running into is that I want it to copy a range if it finds an entry, from A:G, but not an entire row because there is information to the right of G that needs to stay.
This is what I have so far, but it also copied the header over to the new sheet. Can anyone help steer me on this one?
Code:
Sub CopyPasteArchive()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("ArchiveCopy")
Set pasteSheet = Worksheets("ArchivePaste")
Set rngCriteria_v = pasteSheet.Range("O4:O5")
Set rngData_v = copySheet.Range("A1:G50")
Application.CutCopyMode = False
Application.ScreenUpdating = True
rngData_v.AdvancedFilter xlFilterCopy, rngCriteria_v, pasteSheet.Cells(pasteSheet.Rows.Count, "A").End(xlUp)(2)
End Sub
In the end, I want the script to also delete the information from ArchiveCopy, but I thought I would tackle one problem at a time.