Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default textbox validation for date and condition

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default textbox validation for date and condition

thank you !!

Harald Staff wrote:
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

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 May 8th 09 11:15 PM
Making a sound on condition of textbox damorrison Excel Discussion (Misc queries) 4 September 4th 06 11:41 PM
textbox validation TC[_6_] Excel Programming 2 October 13th 04 03:19 AM
textbox value validation girapas[_2_] Excel Programming 1 July 19th 04 12:16 PM
textbox validation Beginner[_2_] Excel Programming 1 April 7th 04 07:46 PM


All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"