Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bk bk is offline
external usenet poster
 
Posts: 28
Default Set max characters in cell (Excel 2007)

Can you set the maximum number of text characters you want entered into a
cell in Excel 2007? If so, how?

thanks,
BK
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Set max characters in cell (Excel 2007)

Maybe you could use data validation?

BK wrote:

Can you set the maximum number of text characters you want entered into a
cell in Excel 2007? If so, how?

thanks,
BK


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
bk bk is offline
external usenet poster
 
Posts: 28
Default Set max characters in cell (Excel 2007)

THANKS! Data Validation did work, didn't even think to work there.

thanks again,
BK

"Dave Peterson" wrote:

Maybe you could use data validation?

BK wrote:

Can you set the maximum number of text characters you want entered into a
cell in Excel 2007? If so, how?

thanks,
BK


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Set max characters in cell (Excel 2007)

The only problem with Data Validation is that you get an error message and
you have to re-type.

You could set up event code to truncate anything over a certain number of
characters after user hits ENTER key

No message, no retyping.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" 'edit to suit
' "A1,A2,B1,C5,C6" for a non-contiguous range example
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) 20 Then
.Value = Left(.Value, 20)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module, Edit the range to suit. Alt + q to return to
the Excel window.


Gord Dibben MS Excel MVP

On Mon, 14 Sep 2009 10:44:01 -0700, BK wrote:

THANKS! Data Validation did work, didn't even think to work there.

thanks again,
BK

"Dave Peterson" wrote:

Maybe you could use data validation?

BK wrote:

Can you set the maximum number of text characters you want entered into a
cell in Excel 2007? If so, how?

thanks,
BK


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Set max characters in cell (Excel 2007)

Good point.

That's why I like to use an adjacent cell formatted in a big red font with a
formula like:
=if(len(a1)<20,"","<-- Too long, please shorten description")

Then I (as the developer) have to worry about which characters to keep (truncate
after 20 or keep the last 20????).

Gord Dibben wrote:

The only problem with Data Validation is that you get an error message and
you have to re-type.

You could set up event code to truncate anything over a certain number of
characters after user hits ENTER key

No message, no retyping.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" 'edit to suit
' "A1,A2,B1,C5,C6" for a non-contiguous range example
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) 20 Then
.Value = Left(.Value, 20)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module, Edit the range to suit. Alt + q to return to
the Excel window.

Gord Dibben MS Excel MVP

On Mon, 14 Sep 2009 10:44:01 -0700, BK wrote:

THANKS! Data Validation did work, didn't even think to work there.

thanks again,
BK

"Dave Peterson" wrote:

Maybe you could use data validation?

BK wrote:

Can you set the maximum number of text characters you want entered into a
cell in Excel 2007? If so, how?

thanks,
BK

--

Dave Peterson


--

Dave Peterson


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
How can I display control characters in Excel 2007? Bungle Excel Discussion (Misc queries) 1 August 24th 09 07:40 AM
Show or Hide control characters in a cell (using Excel 2007)... TK Excel Discussion (Misc queries) 0 June 5th 09 05:19 PM
Custom Lists is limited to 255 characters in Excel 2007 akaustav Excel Discussion (Misc queries) 0 May 25th 09 11:49 AM
Hidden characters in formula bar in Excel 2007 Makua Excel Discussion (Misc queries) 6 November 12th 08 12:43 AM
Japan characters in Excel 2007 vcunning Excel Discussion (Misc queries) 0 February 24th 07 10:36 PM


All times are GMT +1. The time now is 02:30 AM.

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

About Us

"It's about Microsoft Excel"