Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I should have seen that myself. It works great! Thanks again.
-- Cheers, Ryan "Rick Rothstein" wrote: No, you didn't do anything wrong... I did. I added an extra digit requirement after the dash by mistake. Try this instead... ' must have correct Item # to apply to schedule If Len(tbxItemNumber) < 7 Or _ Not tbxItemNumber Like "[0-9Aa][0-9Dd][0-9Tt]##-#" Then strPrompt = "You must have a correct Item # to continue. " & _ "It must be in this format: ''#####-#''" intButtons = vbCritical MsgBox strPrompt, intButtons, strTitle DataValidator = True Exit Function End If -- Rick (MVP - Excel) "RyanH" wrote in message ... I tried entering the following: 11111-1, ADT12-1 and I am getting the MsgBox. Did I do something wrong? ' must have correct Item # to apply to schedule If Len(tbxItemNumber) < 7 Or Not tbxItemNumber Like "[0-9A][0-9D][0-9T]##-##" Then strPrompt = "You must have a correct Item # to continue. It must be " & _ "in this format: ''#####-#''" intButtons = vbCritical MsgBox strPrompt, intButtons, strTitle DataValidator = True Exit Function End If -- Cheers, Ryan "Rick Rothstein" wrote: Give this a try... ' must have correct Item # to apply to schedule If Len(tbxItemNumber) < 7 Or _ Not tbxItemNumber Like "[0-9Aa][0-9Dd][0-9Tt]##-##" Then strPrompt = "You must have a correct Item # to continue. " & _ "It must be in this format: ''#####-#''" intButtons = vbCritical MsgBox strPrompt, intButtons, strTitle DataValidator = True Exit Function End If -- Rick (MVP - Excel) "RyanH" wrote in message ... I guess we all know that IsNumeric does not work 100% of the time when used with Userform Textboxes. This is the format that I am looking for from the users #####-# or ADT##-#. How can I ensure I have this format? This is what I have so far: ' must have correct Item # to apply to schedule If Len(tbxItemNumber) < 7 Then strPrompt = "You must have a correct Item # to continue. It must be " & _ "in this format: ''#####-#''" intButtons = vbCritical MsgBox strPrompt, intButtons, strTitle DataValidator = True Exit Function End If -- Cheers, Ryan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Textbox data to Textbox in Other File | Excel Programming | |||
isnumeric() and hyphen | Excel Programming | |||
Isnumeric | Excel Programming | |||
opposite of IsNumeric | Excel Programming | |||
Not IsNumeric not working - or is it me? | Excel Programming |