View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default textbox validation with 3 conditions

With Me.TextBox2

If .Text < "" And _
(Not IsNumeric(.Text) Or _
Val(.Text) Me.TextBox1.Text) Then

MsgBox "Invalid value"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
Exit Sub
End If

'OTHER CODE
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:854f16425e965@uwe...
Mr.Rick Rothstein gave me correct vb code for testing two textbox for
(equal)values.
How to codify the following logic with Greater than or less than parameter

I have 2 text boxes viz.TextBox1 and Textbox2 in a userform.TextBox1 has a
archival value from a worksheet source.
Condition1:The Textbox2 can be left blank without entering any
data/value.condition2:But if entry is needed only numeric values(numbers
with
or without
decimals) be entered, condition3:and the TextBox2 value should not be
greater
than TextBox1.
cursor should not move from the textbox until
correction/rectification done by user.
While rectification if user deletes whole entry and leave the textbox
blank,
or
corrects the entry by putting exact values as in TextBox1.

--
Message posted via http://www.officekb.com