ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   limiting rows of text in a textbox object? (https://www.excelbanter.com/excel-worksheet-functions/89594-limiting-rows-text-textbox-object.html)

mark

limiting rows of text in a textbox object?
 
Hello.

Is there a way to limit the rows of text in a textbox object (placed in a
worksheet, not a form).

The users want to be able to stop a user from entering more than a certain
amount of text. They don't want any error message to appear (as the
Data-Validation does). They just want it to stop accepting text when it
reaches the visual limit of the space.

With a cell, I didn't figure out a way to do this, because there is no
'keydown' event to check text as it is being entered.... only the worksheet
change event after the ENTER key is pressed, or another cell selected.

In the textbox control, there is a 'keydown' event... so live checking can
happen.

I see the character limit property.. but that doesn't do what is needed,
well. For instance, characters are not all the same widty, so even if you
typed across the whole row, the space would be filled with a different number
of characters, depending upon specifically what characters were entered.

What is needed is a count of the rows of text. Is that possible in either a
textbox control, or in a cell itself with wrap text turned on?

Mark

mark

limiting rows of text in a textbox object?
 
got it.

LineCount property.

sorry.

don't know why I didn't see it earlier.



All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com