ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limit textbox to 255 characters (https://www.excelbanter.com/excel-programming/402987-limit-textbox-255-characters.html)

vqthomf

Limit textbox to 255 characters
 
Hi I have a textbox that user types in a comment and I want to limit the
input to 255 characters. I am using code as below but when I try to remove
the extra characters I get an error can some help please.
TIA
Charles

Select Case Len(TextBox1.Value)
Case Is = 255
MsgBox "You Have Reached The Input Limit Of 255 Characters"

Case Else
lblCounter1.Caption = "Characters remaining " & (255 -
Len(TextBox1.Value))
End Select


vqthomf

Limit textbox to 255 characters
 
Sorry I have worked it out by using the Mid function.
Regards
Charles

"vqthomf" wrote:

Hi I have a textbox that user types in a comment and I want to limit the
input to 255 characters. I am using code as below but when I try to remove
the extra characters I get an error can some help please.
TIA
Charles

Select Case Len(TextBox1.Value)
Case Is = 255
MsgBox "You Have Reached The Input Limit Of 255 Characters"

Case Else
lblCounter1.Caption = "Characters remaining " & (255 -
Len(TextBox1.Value))
End Select


Jean-Yves[_2_]

Limit textbox to 255 characters
 
Hi,

You could use the textbox property "Maxlenght".
Regards
JY

"vqthomf" wrote in message
...
Hi I have a textbox that user types in a comment and I want to limit the
input to 255 characters. I am using code as below but when I try to remove
the extra characters I get an error can some help please.
TIA
Charles

Select Case Len(TextBox1.Value)
Case Is = 255
MsgBox "You Have Reached The Input Limit Of 255 Characters"

Case Else
lblCounter1.Caption = "Characters remaining " & (255 -
Len(TextBox1.Value))
End Select





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

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