+ Reply to Thread
Results 1 to 7 of 7

InputBox Returns Error if Letter input is before letter 'Z'

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    91

    InputBox Returns Error if Letter input is before letter 'Z'

    Hi,

    I have a code that hides columns based on what the user puts as the starting column (end column is fixed).
    But I don't want them to hide anything before column 'Z'. How do I have my code distinguish if the value input is earlier than 'Z' in the alphabet?
    I'd then have an error message pop up and exit the sub

    Thanks!

  2. #2
    Forum Expert (Lazarus)
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    .
    Posts
    2,594

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    I have a code...
    It'd help to see what you have... but you can simply check as "Y" < "Z" (but "y" is not < "Z")...
    Last edited by cytop; 06-22-2017 at 12:10 PM.

  3. #3
    Registered User
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    Quote Originally Posted by cytop View Post
    It'd help to see what you have... but you can simply check as "Y" < "Z" (but "y" is not < "Z")...
    basically i need a code that would return an error if the letter input is A through Y
    I'm trying to avoid having to list 25 separate If functions for each letter
    Is this possible

    Thanks!

  4. #4
    Forum Expert (Lazarus)
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    .
    Posts
    2,594

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    It is very possible - but it'd still help to see your existing code.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    Something like:


    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  6. #6
    Registered User
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    Quote Originally Posted by xladept View Post
    Something like:


    Please Login or Register  to view this content.
    Thanks! the Asc makes 100% sense --
    Though, the value returned is based on the first character, and some columns have 2 charaters, so if someone is inputting AB i'd like it to be allowed

    But I just added this and it made it work


    Please Login or Register  to view this content.
    Thanks again!

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: InputBox Returns Error if Letter input is before letter 'Z'

    You're welcome - good fix!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 12
    Last Post: 07-19-2016, 11:25 AM
  2. Replies: 6
    Last Post: 03-30-2016, 04:28 PM
  3. Replies: 25
    Last Post: 04-21-2015, 10:19 AM
  4. [SOLVED] Excel formula returns 2014 for the letter e and 0 for the letter s
    By jennynz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2014, 06:53 PM
  5. [SOLVED]Order Code has 1 letter added need function to delete said letter
    By king10001 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-23-2013, 01:25 PM
  6. [SOLVED] New Validation option to format 1st letter as Capital letter
    By Jeff in forum Excel General
    Replies: 5
    Last Post: 07-13-2006, 12:15 AM
  7. Replies: 2
    Last Post: 05-09-2005, 04:06 PM

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