Help!!! Moving a row to another sheet after a particular date

Ehfarley

New Member
Joined
Oct 24, 2017
Messages
1
Good Afternoon,

I have 2 sheet's open one "2017" the other is "Close Out", I would like for the row's to duplicate and move to "Close Out" after the date has passed that is populated in column D starting at line 4. Any tip's or pointer's would be greatly appreciated.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try this:
This script will run every time you activate sheet named "2017"
If any date in column "D" is less then todays date the entire rows data will be copied to a sheet named "Close Out"

Now so the script will know this row has already been copied over the cells Interior color will be turned green.
Next time the sheet is activated the script will not copy over any row if column "D" interior color is green.

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab named "2017"
Select View Code from the pop-up context menu
Paste the code in the VBA edit window


Code:
Private Sub Worksheet_Activate()
Dim c As Range
Dim Lastrow As Long
Lastrow = Sheets("Close Out").Cells(Rows.Count, "D").End(xlUp).Row + 1

    For Each c In Range("D4:D" & Cells(Rows.Count, "D").End(xlUp).Row)
    Lastrow = Sheets("Close Out").Cells(Rows.Count, "D").End(xlUp).Row + 1
    
    If c.Value < Date And c.Interior.ColorIndex <> 4 Then
        Rows(c.Row).Copy Sheets("Close Out").Rows(Lastrow)
        c.Interior.ColorIndex = 4
    End If
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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