View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Text Length Data Validation, without error message.

Hi Mark

You need a macro to change cell content. Try this, it truncates all B column
entries exceeding 100:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cel As Range
For Each Cel In Target
If Cel.Column = 2 Then 'B column
If Cel.HasFormula = False Then
If Len(Cel.Value) 100 Then
Cel.Value = Left$(Cel.Value, 100)
End If
End If
End If
Next
End Sub

HTH. Best wishes Harald


"mark" skrev i melding
...
A user would like to have cells limited to a certain length of input, but

not
have an error message displayed if the length is exceeded... just keep the
text up to the limit, and prevent any further entry.

With Data Validation, if you uncheck the checkbox which tells it to show

the
error message, it stops preventing the entry... does not do the checking

for
the limit.

Is there an easy way to limit a cell to 100 characters, say, that when
someone exceeds that limit, the entry is just truncated to 100 without any
error message to click off?

One way that I thought of was some programming with Intersect, but at

least
with the worksheet change event, the Activecell is the current cell, which
isn't necessarily where the user made the change, but where they clicked.

Thanks.
Mark