Check dates for expiry and current date...

christianbiker

Active Member
Joined
Feb 3, 2006
Messages
365
I am currently in the process of creating a task list that is used to prioritize, oddly enough, tasks. I was wondering if there is code that will loop through a specific column with dates in it and tell me the following:
a) there is a task that is due the current day;
b) there is a task that is past the due date?

I would like to perform separate functions based on the result, including a alert box, however if I know the code for one of the 2 I can figure out the other. I would like this task to be performed every time a user opens the worksheet.

Any help would be appreciated.

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The code below will run everytime the workbook is opened.
Sheet1 is selected and the cursor moves to cell H1 and will check each cell in column H until a blank cell is encountered.
If the date in the cell is less than today an error message is generated.

Private Sub Workbook_Open
Sheets("Sheet1").Select
Range("H1").Select
While ActiveCell.Value <> ""
If ActiveCell.Value < Date Then
MyError = MsgBox("You are " & Date - ActiveCell.Value & " days late", vbOKOnly, "Past date")

End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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