View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
tkraju via OfficeKB.com tkraju via OfficeKB.com is offline
external usenet poster
 
Posts: 109
Default code for conditional validation to textboxes

Mr.Rick,
My 3rd question with same conditions(If Textbox2 value should be greater than
TextBox10)
Can I modify the code line to test the both test boxes,for " if textbox2
value should be greater than
textbox1, with all the above conditions remains same.
If Len(.Text)0 And .value TextBox1.value Then
will this modification works or not/

Rick Rothstein (MVP - VB) wrote:
I am probably missing something in your question, but why can't you simply
test if the Text values of the two TextBoxes are equal or not (doesn't
matter if the entry is numeric or not... if there's something in TextBox1,
then it has to equal TextBox2... period)...

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox2
If Len(.Text) 0 And .Text < TextBox1.Text Then
MsgBox "Invalid entry! Entry must match archival value."
Cancel = True
.SelStart = 0
.SelLength = Len(.Text)
End If
End With
End Sub

Rick

Mr.Rick,
I have a some modification of my question,can you modify the code a bit

[quoted text clipped - 54 lines]
or
corrects the entry by putting only numeric values.


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