Format Cell

  • Thread starter Thread starter bennetto
  • Start date Start date
Do you mean format, or did you intend to ask about data validation?
 
Do you mean format, or did you intend to ask about data validation?
 
hi,


Try

Data|Validation - Text length - less than or equal to - enter 30 - OK

Mike
 
hi,


Try

Data|Validation - Text length - less than or equal to - enter 30 - OK

Mike
 
I guess I meant validation but I didn't know it. Mike H's answer worked.
Thank you both for your help!
 
I guess I meant validation but I didn't know it. Mike H's answer worked.
Thank you both for your help!
 
Thanks, Mike! I knew it was something simple. You made me look good...
Terri
 
Thanks, Mike! I knew it was something simple. You made me look good...
Terri
 
Are you sure you're willing to put up with typing 31 letters and getting the
error message which tells you to do it all over again?

I would use event code which limits the text to 30 characters or less
without the annoying message DV provides.

Example code...................no error trapping for text or dates

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" 'edit to suit
Dim cell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If Len(.Value) > 30 Then
.Value = Left(.Value, 30)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
Are you sure you're willing to put up with typing 31 letters and getting the
error message which tells you to do it all over again?

I would use event code which limits the text to 30 characters or less
without the annoying message DV provides.

Example code...................no error trapping for text or dates

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" 'edit to suit
Dim cell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If Len(.Value) > 30 Then
.Value = Left(.Value, 30)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top