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!!!! |
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!!!! |
All times are GMT +1. The time now is 11:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com