Hello durandal5,
Here is the code for the Textbox control and the macro to verify the input.
Textbox Event Code
Private Sub TextBox1_AfterUpdate()
VerifyInput ActiveControl
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If ActiveControl.Tag = "failed" Then
Cancel = True
ActiveControl.Tag = ""
End If
End Sub
Macro Code to Verify Input
Sub VerifyInput(TB As MSForms.TextBox)
Dim Text As String
Text = InputBox("Please re-enter the text into the box below.")
If Text <> "" Then
If Text <> TB.Value Then
MsgBox "The text doesn't match - try again."
TB.Value = ""
TB.Tag = "failed"
End If
End If
End Sub
Sincerely,
Leith Ross
Bookmarks