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.
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: