Check dates for expiry and current date...

christianbiker

Active Member
Joined
Feb 3, 2006
Messages
362
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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

SiddersAtCHEP

Board Regular
Joined
Nov 2, 2005
Messages
104
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
 

Watch MrExcel Video

Forum statistics

Threads
1,133,651
Messages
5,660,133
Members
418,551
Latest member
rambo17

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
Top