Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Limit text input in Excel 2003

I have seen a lot of posts talking about how to "limit" the text input
of a cell to a certain number of characters, but using the data
validation option does not stop the user from entering more than a
defined number, it just warns that it is invalid.

What can I do to make typing more than 36 characters impossible? I
just want the input to stop after 36, and if data is pasted into the
cell, I would want it cut off at 36.

Thanks for any help you can give.

-Erich
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 3,885
Default Limit text input in Excel 2003

Hi
AFAIK this is not possible in a cell direct as a macro can't run while
you're in Edit mode

--
Regards
Frank Kabel
Frankfurt, Germany

"Agent37" schrieb im Newsbeitrag
om...
I have seen a lot of posts talking about how to "limit" the text

input
of a cell to a certain number of characters, but using the data
validation option does not stop the user from entering more than a
defined number, it just warns that it is invalid.

What can I do to make typing more than 36 characters impossible? I
just want the input to stop after 36, and if data is pasted into the
cell, I would want it cut off at 36.

Thanks for any help you can give.

-Erich


  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Limit text input in Excel 2003

Data validation option DOES stop the user from entering more than a defined
number and it DOESN'T.

It DOES if two conditions concur:
1. within the Validation dialog window you go to tab 'Error Alert', check
'Show error alert after...' box and select Stop from the 'Style' dropdown.
2. the user manually enters the value or a formula returning that value into
each individual cell.

It DOESN'T if the user copy/paste the value into the cell, copies values or
formulas by dragging the little + in the bottom-right corner of the cell, or
enters the value via VBA.

To ensure there are not more than 36 characters in a cell you could use a
combination of the Validation option and the below code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRng As Range
Set MyRng = Range("A1")
If MyRng.Characters.Count 36 Then
MyRng = Left(MyRng, 36)
MsgBox "Your text is too long and" & Chr(13) _
& "will be cut to 36 charachters."
End If
End Sub


KL

"Agent37" wrote in message
om...
I have seen a lot of posts talking about how to "limit" the text input
of a cell to a certain number of characters, but using the data
validation option does not stop the user from entering more than a
defined number, it just warns that it is invalid.

What can I do to make typing more than 36 characters impossible? I
just want the input to stop after 36, and if data is pasted into the
cell, I would want it cut off at 36.

Thanks for any help you can give.

-Erich



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
columns limit in excel 2003 Mohan Excel Discussion (Misc queries) 1 November 6th 08 02:42 AM
limit text length in a text box in excel 2003 Darren New Users to Excel 1 May 14th 08 02:14 PM
Restrict-Filter-Limit-Validate user input in Excel Dr. Thom Excel Discussion (Misc queries) 0 January 22nd 06 08:06 PM
Limit input in a textbox James Agostinho Excel Programming 2 September 10th 03 03:10 PM
Limit character input Mike[_37_] Excel Programming 2 August 13th 03 08:18 PM


All times are GMT +1. The time now is 11:18 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"