EXCEL: Date Late Submission

yakult014

New Member
Joined
Apr 13, 2020
Messages
12
Office Version
  1. 2010
Platform
  1. Windows
Hi, I want to show if textDate.value is equal or is not greater than 1 day textDateSubmission.value show "On Time".
Then if the textDate is greater than one day to textDateSubmission show (Days of late)" days late"

VBA Code:
if TextBoxDate - TextBoxReceived > 1, TextBoxReceived - TextBoxDate "days late on time","On time"))

Is this possible?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Convert the values in the 2 textboxes to valid dates and compare the converted values
One way if date entered as text in both textboxes ...
VBA Code:
Private Sub TextBoxReceived_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Dim recd As Date, due As Date, txt As String
    txt = "On Time"
    recd = CDate(TextBoxReceived.Text)
    due = CDate(TextBoxDate.Text)

    If recd > due Then txt = recd - due & " days late"
    textDateSubmission.Text = txt
End Sub

compare dates.jpg
 
Last edited:
Upvote 0
Convert the values in the 2 textboxes to valid dates and compare the converted values
One way if date entered as text in both textboxes ...
VBA Code:
Private Sub TextBoxReceived_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Dim recd As Date, due As Date, txt As String
    txt = "On Time"
    recd = CDate(TextBoxReceived.Text)
    due = CDate(TextBoxDate.Text)

    If recd > due Then txt = recd - due & " days late"
    textDateSubmission.Text = txt
End Sub

View attachment 14184
Wow amazing sir. Is it possible sir to not use button. Can we use afterUpdate?
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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