Это не ответ, это просто для того, чтобы помочь вам увидеть его более четко. Все, что я сделал, это перестроил ваш код и обеспечил последовательный отступ
У вас не было конечного сабвуфера для одной процедуры и кодасмешанный между двумя, с endif, который принадлежал одному в другом
В любом случае - это ваш код ... только с небольшими изменениями .... сделайте процедуру выхода, просто проверьте 1 поле
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'Check if data in TextBox is date
If Not (IsDate(TextBox3.Text)) Then ' And (IsDate(TextBox4.Text)) And (IsDate(TextBox5.Text)) And (IsDate(TextBox6.Text))) Then
MsgBox "Date Required"
Cancel = True
Else
End If
End Sub
Private Sub CommandButton1_Click()
'Last ditch validation before committing input values to document.
Dim booConfirmation As Boolean
'Check for data
'Display name so user can check and confirm.
booConfirmation = MsgBox("Are the entries " & TextBox1 & " " & TextBox2 & " " & TextBox3 & " " & TextBox4 & " " & TextBox7 & " " & TextBox8 & " " & TextBox9 & " " & TextBox10 & " " & TextBox11 & "correct?", vbYesNo)
'If booConfirmation Then
If booConfirmation = vbNo Then
MsgBox "Please correct the entries"
Set ws = Sheets("Inputs")
LastRow = ws.Range("B" & Rows.Count).End(xlUp).Row + 1
ws.Range("B" & LastRow).Value = "" 'if entries are incorrect erase the data that should be entered into the sheet'
ws.Range("C" & LastRow).Value = ""
ws.Range("D" & LastRow).Value = ""
ws.Range("E" & LastRow).Value = ""
ws.Range("F" & LastRow).Value = ""
ws.Range("G" & LastRow).Value = ""
ws.Range("H" & LastRow).Value = ""
ws.Range("I" & LastRow).Value = ""
ws.Range("J" & LastRow).Value = ""
ws.Range("K" & LastRow).Value = ""
ws.Range("L" & LastRow).Value = ""
Exit Sub
Else
Set ws = Sheets("Inputs")
LastRow = ws.Range("B" & Rows.Count).End(xlUp).Row + 1
ws.Range("B" & LastRow).Value = TextBox1.Text 'Adds the TextBox1 into Col B & Last Blank Row
ws.Range("C" & LastRow).Value = TextBox2.Text 'Adds the TextBox2 into Col C & Last Blank Row
ws.Range("D" & LastRow).Value = TextBox3.Text
ws.Range("E" & LastRow).Value = TextBox4.Text
ws.Range("F" & LastRow).Value = TextBox5.Text
ws.Range("G" & LastRow).Value = TextBox6.Text
ws.Range("H" & LastRow).Value = TextBox7.Text
ws.Range("I" & LastRow).Value = TextBox8.Text
ws.Range("J" & LastRow).Value = TextBox9.Text
ws.Range("K" & LastRow).Value = TextBox10.Text
ws.Range("L" & LastRow).Value = TextBox11.Text
End If
Unload Me
End Sub