+ Reply to Thread
Results 1 to 6 of 6

Limiting cell input characters

  1. #1
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Limiting cell input characters

    I need a specific cell to accept only combination of :
    Text
    Numbers
    the symbol "-"
    The symbol "_".
    If the text contains any other symbol or character, excel should reject the text.

    how could I do this?
    Thanks a million.
    Last edited by Paul; 05-04-2011 at 12:06 PM. Reason: Marking as solved per user request.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Can you give a number of examples?
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186
    The following are correct:
    Tom_03
    Bio-Technology
    12_12_2007

    The following should be rejected:
    Tom#03 (# not allowd)
    Tom.03 (. not allowd)
    Bio Technology (spaces are not allowd)
    12/12/2007 (/ is not allowd)

    In conclusion, any combination of character as long as there are only numbres, text or the symbols "_" and "-"

    Thanks

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Wizz and OldChippy,

    I don't think that link will help since there is no length restriction, nor do any characters have to be specific to a certain position. Data Validation doesn't seem to be strong enough to handle the myriad of random combinations of letters/numbers/-/_ either.

    I would suggest using a macro such as the one below, attached the the Sheet in question. It is a worksheet_Change event that will only be triggered when cell A1 is changed. Adjust Range("A1") to your specific cell as mentioned in the original post.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi Paul,

    That seems to do the job - must get into this VBA stuff!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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