ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conditional validation (https://www.excelbanter.com/excel-programming/412285-conditional-validation.html)

tkraju via OfficeKB.com

conditional validation
 
On a userform textbox1,in the same userform on multipage 1 textbox2 is there.
I want to validate textbox2 : If textbox1 text is equal to "PAID" then entry
in textbox2 is not required,skip the entry and goto next tabstop.If textbox1
text is equal to "DUE",validate the textbox2 for a number(text) equal to 1000.
Data entry is is not must,can be left blank,but if entered it should be a
number(text) 1000.
I have tried with Private Sub Textbox2_Exit(ByVal Cancel As MSForms.
ReturnBoolean) , but could not succeed.Thanks in anticipation.

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


stefan onken

conditional validation
 
hi,
you could use code like this in TextBox2_Exit

If TextBox1 = "DUE" Then
If TextBox2 < "" Then
If TextBox2 < "1000" Then
MsgBox "enter 1000"
Cancel = True
End If
End If
End If

but this event fires only if you change to a control on the same page
of the multipage.
eventually, you need more/other events for the validation, e.g.
Multipage_Exit

stefan

On 9 Jun., 04:45, "tkraju via OfficeKB.com" <u16627@uwe wrote:
On a userform textbox1,in the same userform on *multipage 1 textbox2 is there.
I want to validate textbox2 : If textbox1 text is equal to "PAID" then entry
in textbox2 is not required,skip the entry and goto next tabstop.If textbox1
text is equal to "DUE",validate the textbox2 for a number(text) equal to 1000.



All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com