View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Executor Executor is offline
external usenet poster
 
Posts: 74
Default How to re-set focus to the text box after deleting invalid data?

Hi Vinay,

Tou can use the exit event for the textbox:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(TextBox1.Text) Then
MsgBox "DATE ENTERED IS INVALID. PLEASE RE-ENTER",
vbExclamation, "Retry"
Me.TextBox1.Text = ""
Cancel = True
End If
End Sub

Hoop This Helps

Wouter