VBA macro to transfer data based on date

RockstarJim

New Member
Joined
Aug 22, 2018
Messages
5
Hello all,

I have data for projects on a sheet named Master with several target dates. What I am wanting to do is transfer all data within that row to another sheet named Past Due, when the date in column F surpasses "todays" date. I would like this to happen automatically at midnight, but if that is not possible I could do it using a commend button.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Sounds like this should be run from the Windows Task Scheduler.
1. Setup a PowerShell script to run Excel macro
2. Create a .bat file to run the PowerShell script
3. Create a basic task in the Windows Task Scheduler to run the .bat to run at the specific time
 
Upvote 0
So this is what I got so far, but will not work with the correct date. column F holds the target date, and if that target date has passed "today's" date, it should copy the complete row to the past_due sheet.

Private Sub CommandButton1_Click()


Dim rng As Range
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet


Set pasteSheet = Worksheets("Past_Due")
Set rng = Range("A4").CurrentRegion
Set rng = rng.Offset(1, 0)


If Sheets(Master).Cells(F, Column).Value <= today Then
Sheets(Past_Due).Rows(F).EntireRow.Hidden = False
End If


rng.Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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