+ Reply to Thread
Results 1 to 2 of 2

Can excel limit the characters in a cell to 28 automatically?

  1. #1
    Tom
    Guest

    Can excel limit the characters in a cell to 28 automatically?

    I have a list of products, about 4000 in all. One of the columns is the
    description of the product. Can Excel limit the descriptions to 28 characters
    by cutting off anything over that number?

    Please help!!!!

  2. #2
    Bernie Deitrick
    Guest

    Re: Can excel limit the characters in a cell to 28 automatically?

    Tom,

    Two ways:

    1) Use data validation. Slect the column, choose Data / Validation...., choose "Allow" = "Text
    length", "Data" = "Less than or Equal To", and "Maximum" = 28

    2) Use an event: copy the code below, right click on the sheet tab, select view code and paste the
    code in the window that appears. As written, it will work with column D.

    HTH,
    Bernie
    MS Excel MVP

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column <> 4 Then Exit Sub
    If Len(Target.Value) > 28 Then
    Application.EnableEvents = False
    Target.Value = Left(Target.Value, 28)
    MsgBox "I truncated your entry to 28 characters."
    Application.EnableEvents = True
    End If
    End Sub



    "Tom" <[email protected]> wrote in message
    news:[email protected]...
    >I have a list of products, about 4000 in all. One of the columns is the
    > description of the product. Can Excel limit the descriptions to 28 characters
    > by cutting off anything over that number?
    >
    > Please help!!!!




+ 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