+ Reply to Thread
Results 1 to 5 of 5

cell entry restricted to text, 2-3 letters & uppercase

  1. #1
    Registered User
    Join Date
    12-19-2007
    Posts
    2

    cell entry restricted to text, 2-3 letters & uppercase

    I have been struggling to write a macro to automatically do the following in an Excel column range:
    - limit the cell entry to text only (no periods, dashes, spaces, numbers, etc)
    - restrict the text entry to either 2 or 3 letters
    - convert the text entry to uppercase only.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474
    Quote Originally Posted by whitSC
    I have been struggling to write a macro to automatically do the following in an Excel column range:
    - limit the cell entry to text only (no periods, dashes, spaces, numbers, etc)
    - restrict the text entry to either 2 or 3 letters
    - convert the text entry to uppercase only.
    Use Data Validation:
    1. Select Column A.
    2. Data --> Data Validation --> Settings --> Custom
    3. Enter the following formula in the Formula box:
    =ISTEXT(A1)
    4. Click OK
    http://www.exceltip.com/st/Restricti..._Only/884.html
    2 to ensure not more then 2 characters in column A and change text to upper case
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe just with validation

    =AND(LEN(A1)<=2,ISTEXT(A1),ISERROR(SEARCH("/",A1)),ISERROR(SEARCH(".",A1)),ISERROR(SEARCH(" ",A1)))
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    12-19-2007
    Posts
    2

    Post

    I don't know why, but the ISTEXT function doesn't work at all. No matter what I put in, with the exception of numbers only, it accepts the data and registers True.

    The VBA macro works fine. I had to modify it a little to restrict it to 2-3 letters as shown.

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474
    Quote Originally Posted by whitSC
    I don't know why, but the ISTEXT function doesn't work at all. No matter what I put in, with the exception of numbers only, it accepts the data and registers True.

    The VBA macro works fine. I had to modify it a little to restrict it to 2-3 letters as shown.

    Please Login or Register  to view this content.
    Hi,
    I just tried the data validation as described in my first post and it works for me

+ 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