Moving Files into an archive

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a project list in excel that I track and would like to know if there
is a way when an item is completed I can set it up that it automatically goes
to an archive worksheet the following week.
 
Yes, that would be possible using VBA. You would need to have a
completion date in your data though. Then you could usse the
Workbook_Open event (or Auto_Open) to cycle through the main sheet and
anything that has a completion date les than todas date minus 7 days.
Something like:

One Way:
Private Sub Workbook_Open()
Dim r As Long
With Sheets("Main")
For r = 2 To .Cells(65536, 1).End(xlUp).Row
With .Cells(r, 1)
If .Value < Date - 7 Then
.EntireRow.Cut Destination:= _
Sheets("Archive").Cells(65536, 1) _
.End(xlUp).Offset(1, 0)
End If
End With
Next r
End With
End Sub

This code would need to be placed in the ThisWorkbook code module.
The above code doesn't handle the deletion of the cut row. That could
always be incorporated though. Also, this is assuming that the
completion date is in column A.
 
Thanks JW will give it a try.

JW said:
Yes, that would be possible using VBA. You would need to have a
completion date in your data though. Then you could usse the
Workbook_Open event (or Auto_Open) to cycle through the main sheet and
anything that has a completion date les than todas date minus 7 days.
Something like:

One Way:
Private Sub Workbook_Open()
Dim r As Long
With Sheets("Main")
For r = 2 To .Cells(65536, 1).End(xlUp).Row
With .Cells(r, 1)
If .Value < Date - 7 Then
.EntireRow.Cut Destination:= _
Sheets("Archive").Cells(65536, 1) _
.End(xlUp).Offset(1, 0)
End If
End With
Next r
End With
End Sub

This code would need to be placed in the ThisWorkbook code module.
The above code doesn't handle the deletion of the cut row. That could
always be incorporated though. Also, this is assuming that the
completion date is in column A.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top