two sheets copying information

  • Thread starter That's Confidential
  • Start date
T

That's Confidential

I have two sheets in a file. In each row of the first sheet, I have
information, with a date inputted in the cell of that row in column K. Now,
what I want is for, five days after the date in the cell in K, I would like
the info to be deleted from the sheet and copied over to sheet number 2.
Now, I would like all the rows in sheet 1 to move up a line otherwise there
will be spaces.

Any hints?
 
V

Vasant Nanavati

You need a macro such as the following:

Sub MoveToSheet2After5Days()
Dim c As Range
With Sheet1
For Each c In Intersect(.UsedRange, .Columns("K"))
If IsDate(c) Then
If Date - c >= 5 Then
c.EntireRow.Copy Sheet2.UsedRange(1,
1).Offset(1).EntireRow
c.EntireRow.Delete
End If
End If
Next
End With
End Sub
 

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

Top