Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tom
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick
 
Posts: n/a
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can excel automatically enter the date data in a cell was entered mg_sv_r Excel Worksheet Functions 4 September 5th 08 11:09 AM
How do I automatically fill a cell based on another cell in Excel SouthCarolina Excel Discussion (Misc queries) 3 January 13th 06 12:52 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
a way to limit the characters allowed in a cell? EmRit24 Excel Worksheet Functions 3 April 29th 05 09:30 PM
Excel: How do I enter a date in one cell & automatically dates adj Shannon Excel Discussion (Misc queries) 4 January 12th 05 12:51 AM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"