+ Reply to Thread
Results 1 to 6 of 6

Set the limit characters length in a cell

  1. #1
    Registered User
    Join Date
    07-29-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    14

    Set the limit characters length in a cell

    Hi all

    I would like to set 15 characters max in cell, i can set this max characters under the "Data Vaildation" . How can i set this function by VBA ?

  2. #2
    Registered User
    Join Date
    08-13-2015
    Location
    Brussels
    MS-Off Ver
    2010
    Posts
    7

    Re: Set the limit characters length in a cell

    Hi

    try this :

    With Selection.Validation

    .Delete
    .Add Type:=xlValidateTextLength, AlertStyle:=xlValidAlertStop, _
    Operator:=xlBetween, Formula1:="0", Formula2:="15"

    End With

    Regards

    Geert

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Set the limit characters length in a cell

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-29-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    14

    Re: Set the limit characters length in a cell

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Hi, Its work, but how to set this on Column B3:B100,D3:D100,F3:F100 ?

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Set the limit characters length in a cell

    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  6. #6
    Registered User
    Join Date
    07-29-2015
    Location
    Hong Kong
    MS-Off Ver
    2007
    Posts
    14

    Re: Set the limit characters length in a cell

    Its work, Thank you very much

+ 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. Cell length formula to remove any characters over 31 in length
    By tehkayd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2015, 11:45 AM
  2. [SOLVED] Shorten string length if exceeds 31 characters (max sheet name length)
    By r2fro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:57 AM
  3. Replies: 7
    Last Post: 01-25-2014, 07:53 AM
  4. [SOLVED] Cell length VBA to add trailing characters until a specified length is reached
    By bkeller83 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-24-2013, 10:43 PM
  5. Limit character type and length in cell possible?
    By Fidd$ in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 07-01-2010, 04:31 AM
  6. [SOLVED] Can I limit a cell to 2 characters?
    By Frankc in forum Excel General
    Replies: 2
    Last Post: 08-10-2005, 09:05 PM
  7. How do I limit the character length of a cell when typing
    By Andy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2005, 11:05 AM

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