Live validation of keystrokes

mscantle

New Member
Joined
Feb 9, 2011
Messages
7
I have a cell in which users can type comments. I wish to restrict the number of characters they can enter. However, I can't use the normal data validation method because this only tells users they have entered too many characters once they have pressed the Enter key. It then allows them to retry, in which case they need to delete loads of stuff to comply with the character limit and may have wasted lots of time.

What I want to do is to keep a live count of the number of keystrokes they have made as they type. Once they reach the limit, I want to display a message telling them that they've reached the character limit and then allow them to make changes as necessary.

I'm using Excel 2007 VBA on Windows 7.

Any ideas gratefully received,

Matt
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top