Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having difficulty with my code. I have a userform with several
textboxes. The user enters the number of cashiers into txtQty. txtCnt is the number of cashiers actually listed. I want to check to make sure the number of cashiers entered does not exceed the actual number of cashiers. if it does a message box displays the difference. If not it continues on with the rest of the code. I put in the MsgBox " its not working" to help test. the code works as designed unless txtQty is 10 or over regardless of the value of txtCnt. If Not IsNumeric(txtQty.Value) Then MsgBox "Please enter a cashier number" Exit Sub ElseIf txtQty.Value txtCnt.Value Then MsgBox txtQty.Value - txtCnt.Value Exit Sub ElseIf txtQty.Value 10 Then Dim Msg, Style, Title, Help, Ctxt, Response, MyString Msg = "You chose " & txtQty.Value & " cashiers. Is this correct?" Style = vbYesNo + vbCritical + vbDefaultButton2 Title = "Verify Input" Response = MsgBox(Msg, Style, Title, Help, Ctxt) If Response = vbNo Then MsgBox "Please re-enter the correct number of cashiers" Exit Sub Else: GoTo x End If Else: MsgBox " its not working" Exit Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Elseif? | Excel Worksheet Functions | |||
elseif | Excel Programming | |||
IF..Then..ELSE.. ELSEIF | Excel Programming | |||
If, ElseIf | Excel Programming | |||
If...Elseif...End If | Excel Programming |