CheckDate box date vs today

Rtkinnell

New Member
Joined
May 29, 2019
Messages
11
Please help with the following as i am running into a brick wall here. i am writing a spread sheet for daily engine maintenance. I have already gotten if service due by hours working properly with the following code.

Private Sub Worksheet_Calculate()
If Range("G9").Value < 25 And Range("L9").Value = False Then
MsgBox "Service Required Port Main: Refer to OEM Maintenance Report for further detail." & vbNewLine & "Select Yes To Acknowledge Service Due", vbYesNo
If MsgBox("Service Required Port Main: Refer to OEM Maintenance Report for further detail." & vbNewLine & "Select Yes To Acknowledge Service Due", vbYesNo) = vbYes Then
Range("L9").Value = True
Else: Range("L9").Value = False
End If

Now i need if service due by date display the same message. I need this worded as the following in some manner.

ElseIf Range("N9 - B29").Value <= 1 And Range("L9").Value = False And Range("B29").Value = Today() Then
MsgBox "Service Required Port Main: Refer to OEM Maintenance Report for further detail." & vbNewLine & "Select Yes To Acknowledge Service Due", vbYesNo
If MsgBox("Service Required Port Main: Refer to OEM Maintenance Report for further detail." & vbNewLine & "Select Yes To Acknowledge Service Due", vbYesNo) = vbYes Then
Range("L9").Value = True
Else: Range("L9").Value = False
End If


N9 is the date in which service is due. B29 is the date box for each worksheet, L9 is a checkbox the is an acknowledgement that service is due. It has either got to be my subtraction of n9-b29 or b29=today() that is getting me here as i know the l9.value = false is correct. Also if not obvious this is to run as a macro not a function. the code will be repeated on 31 sheet (days of month) for 12 Engines. I had it worked out without using the final if b29=today,however with out verifying that b29 was actually today's date i ended up with a loop of the msgbox coming up 31 times. I only want this message on the day in which the engine hours are entered.
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,214,788
Messages
6,121,588
Members
449,039
Latest member
Arbind kumar

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