Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set cells to take a max of 23 chars ?

Status
Not open for further replies.

natatbh

Programmer
Dec 18, 2002
81
US
I would like to set a column in a worksheet so that its cells won't except more than 23 characters. I already did this by setting the data validation. The problem is that it only prompts the users after he leaves the cell (at that time he might have already entered 200 characters). I would like to have a way to prompt the user when he enters the 24th character
that he can't enter more than 23 characters. It seems that this can't be done in a straight, simple way. If anyone has some kind of work around please help.

Thanks!
natatbh
 
You could use a left function in the column next to the field=left('cell',23).
or set that procedure up as a macro
 
Thanks weetnie

Thanks for your reply. Sorry, but this doesn't solve my problem. I want to give the user a message when he enters the 24th character, not when he finishes typing 200 characters and moves out of the cell.

Any help, please go ahead

Thanks.
 
Unfortunately, I'm not sure you can do this (in a cell)
There is no event that is fired until the data has been entered so you cannot test for the length of the data that is currently yet to be entered. If, however, you use a textbox, you can trap every entry made and so can test for the length of the currently entered string. If this is really necessary, you might want to consider using an input FORM rather than just entering data directly onto the spreadsheet... Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top