Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 310
Default Setting Field Size in Excel 2003

I am trying to modify a form created by a co-worker. He has it set to type as
many characters in a field as a user wants but then gives a warning when you
hit enter letting you know that you have used more than the allowed number of
characters for that field.

Is there a way to set up each field to stop typing once the maximum number
of characters have been reached rather than having to go back and delete
characters once the typing is done?

Thanks for any assistance you may be able to provide on this subject!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Setting Field Size in Excel 2003

No

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

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 Tue, 9 Sep 2008 08:54:01 -0700, michelle
wrote:

I am trying to modify a form created by a co-worker. He has it set to type as
many characters in a field as a user wants but then gives a warning when you
hit enter letting you know that you have used more than the allowed number of
characters for that field.

Is there a way to set up each field to stop typing once the maximum number
of characters have been reached rather than having to go back and delete
characters once the typing is done?

Thanks for any assistance you may be able to provide on this subject!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 310
Default Setting Field Size in Excel 2003

Thanks Gord...I'll give it a try ;)

"Gord Dibben" wrote:

No

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

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 Tue, 9 Sep 2008 08:54:01 -0700, michelle
wrote:

I am trying to modify a form created by a co-worker. He has it set to type as
many characters in a field as a user wants but then gives a warning when you
hit enter letting you know that you have used more than the allowed number of
characters for that field.

Is there a way to set up each field to stop typing once the maximum number
of characters have been reached rather than having to go back and delete
characters once the typing is done?

Thanks for any assistance you may be able to provide on this subject!



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
Setting field size and type tsap Excel Discussion (Misc queries) 1 December 13th 07 11:05 PM
Excel 2003 - setting the Comment font size default rickz Excel Worksheet Functions 3 July 16th 07 03:53 AM
custom size (page size) missing in excel 2003 Donald Borja Setting up and Configuration of Excel 1 May 22nd 06 10:53 AM
How do I unlimit field size in using Excel Pivot Tables? CBK Excel Discussion (Misc queries) 1 January 5th 06 09:14 PM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM


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

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"