Sub Date()
'Input Box
RetryDateBox:
'Dim First_Payment_Date As String
First_Payment_Date = Application.InputBox("Enter the new First Payment Date. Format mm/dd/yyyy")
If (First_Payment_Date) = "0" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If (First_Payment_Date) Like "*.*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If (First_Payment_Date) Like "*-*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If (First_Payment_Date) Like "*+*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If (First_Payment_Date) = False Then
'Option 1 Cancel
'MsgBox "Cancel. Wrong Info", , "CIT FBI"
Exit Sub
Else
If First_Payment_Date = "" Then
' Option 2 Empty
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
Else
'Option 3 Not Empty
'Check Lenght 10 Characters
If Len(First_Payment_Date) > 10 Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If Len(First_Payment_Date) < 10 Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
Slash1 = Mid(First_Payment_Date, 3, 1)
Slash2 = Mid(First_Payment_Date, 6, 1)
If Slash1 <> "/" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If Slash2 <> "/" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
First_Payment_Date = Replace(First_Payment_Date, "/", "")
If IsNumeric(First_Payment_Date) = False Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
First_Payment_DateMM = Mid(First_Payment_Date, 1, 2)
First_Payment_DateDD = Mid(First_Payment_Date, 3, 2)
First_Payment_DateYYYY = Mid(First_Payment_Date, 5, 4)
If First_Payment_DateDD Like "*/*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateMM Like "*/*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateYYYY Like "*/*" Then
MsgBox "The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateMM < 1 Then
MsgBox "Month has to be between 1 and 12. The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateMM > 12 Then
MsgBox "Month has to be between 1 and 12. The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateDD < 1 Then
MsgBox "Day has to be between 1 and 31. The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
If First_Payment_DateDD > 31 Then
MsgBox "Day has to be between 1 and 31. The Date format mm/dd/yyyy in incorrect. Ex: 12/24/2016 Please try again", , "COMPANY"
GoTo RetryDateBox
End If
First_Payment_Date = First_Payment_DateDD & "/" & First_Payment_DateMM & "/" & First_Payment_DateYYYY
End If
End If
'Input Box End
End Sub