Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a user form I want to ensure that textbox7 contains either YES or NO when
the form is completed. If there is anything else in textbox7, I want the form shown again with the focus on textbox7 and its contents highlighted. The following does not set the focus or highlight the contents but doesn't let me exit the form until I have yes or no in the textbox. Can someone tell me what is missing please? Private Sub CommandButton1_Click() Dim test As Boolean again1: test = UCase(TextBox7.Value) = "YES" Or UCase(TextBox7.Value) = "NO" If Not test Then normLog10.Hide MsgBox (TextBox7.Value & " is not acceptable, must be yes or no" & vbCrLf & vbCrLf & _ " Try again") normLog10.Show TextBox7.SetFocus TextBox7.SelStart = 0 TextBox7.SelLength = 100 GoTo again1: End If end sub Thanks Chris |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to: User Form to assign a user defined range to a macro variab | Excel Programming | |||
setfocus on multipage tab form gives error message | Excel Programming | |||
SetFocus in user form | Excel Programming | |||
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form | Excel Programming |