View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default textbox validation for date and condition

This is just as much a When question, you must do everything after entry is
done:

Private Sub CommandButton1_Click()
Dim DT As Date
On Error Resume Next
DT = DateValue(Me.TextBox1.Text)
Select Case DT
Case 0 To DateSerial(1910, 1, 1)
MsgBox "no good"
Me.TextBox1.Text = ""
Me.TextBox1.SetFocus
Case Date + 1 To Date + 1000000
MsgBox "no good"
Me.TextBox1.Text = ""
Me.TextBox1.SetFocus
Case Else
MsgBox DT
End Select
End Sub


"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:85abf58b3f3ac@uwe...
How to validate a textbox entry(userform) for date entry and not be
greater
than today's date.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200806/1