+ Reply to Thread
Results 1 to 13 of 13

Check to see if input box content is uppercase

  1. #1
    Registered User
    Join Date
    12-27-2009
    Location
    Iowa City, IA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Check to see if input box content is uppercase

    I want to check that the information a user enters into the input box prompt is only uppercase and numbers. If it meets this criteria then the program continues otherwise it gives and error msgbox that prompts them with the correct formating until a correct entry has been made? any idea how to do this?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Check to see if input box content is uppercase

    Example removed; I provided a better example in the next post
    Last edited by 6StringJazzer; 10-10-2011 at 03:53 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Check to see if input box content is uppercase

    Here is something more specific to your question, that loops until the right answer is given.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Thumbs up Re: Check to see if input box content is uppercase

    hmm... try this out (see attached to run the macro and step through to see what's it's doing:

    Needed a little more code to do this...found a way to loop and repeat the query until the input is OK

    Enjoy and rate please

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Check to see if input box content is uppercase

    guess mine is kinda ugly...but the general principle is good. I just used an array to spell out exactly what characters are OK and all others are not...may be a better way to test "alpha-numeric-ness" of input but this seems to work.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Check to see if input box content is uppercase

    Quote Originally Posted by GeneralDisarray View Post
    guess mine is kinda ugly...but the general principle is good. I just used an array to spell out exactly what characters are OK and all others are not...may be a better way to test "alpha-numeric-ness" of input but this seems to work.
    Please see my example posted above yours.

  7. #7
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Check to see if input box content is uppercase

    but, he wanted uppercase letters and numbers right? what about the numbers?

    also, when i tested your reply, the loop exits with non-alpha characters. FOr example "&&&THE&&" is not kicked back.
    Last edited by GeneralDisarray; 10-10-2011 at 04:08 PM.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Check to see if input box content is uppercase

    Another way:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Check to see if input box content is uppercase

    o_0 dang...that is the empitamy of slickness

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Check to see if input box content is uppercase

    Quote Originally Posted by GeneralDisarray View Post
    but, he wanted uppercase letters and numbers right? what about the numbers?

    also, when i tested your reply, the loop exits with non-alpha characters. FOr example "&&&THE&&" is not kicked back.
    Uppercasing a string leaves the numbers alone, so you don't have to check for them explicitly.

    However, I made a mistake in forgetting about special characters. If special characters are not allowed then my solution doesn't work. The following code corrects this:

    Please Login or Register  to view this content.
    shg's solution using regular expressions is quite nice, although in this case Like provides economy.
    Last edited by 6StringJazzer; 10-10-2011 at 09:14 PM. Reason: changed "Until Not" to "While" though both are equivalent

  11. #11
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Check to see if input box content is uppercase

    If you dont mind puncuation and such
    Please Login or Register  to view this content.
    is a quick and easy test.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Check to see if input box content is uppercase

    Quote Originally Posted by mikerickson View Post
    If you dont mind puncuation and such...
    See post #3 and ensuing discussion....

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Check to see if input box content is uppercase

    I would recommend 6SJ's Like method in preference to my RegExp.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1