LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Limiting number of characters in textbox

Thanks Bernie for your reply. I reply the same day but when I look again it
had not be displayed, lost into space. The second part of textbox fills from
the right and if I set the max to 5 it won't allow me to enter or change the
numbers. I need it to fill from right and stop after five numbers with error
message saying it cannot be more than 5 numbers.

I'll keep trying for a solution
ViViC



wrote:
Hi there!
Try something like this.
You will need to set the Textbox1.MaxLength property either through
the Textbox1 properties menu in the VBE or programmatically (somthing)
like this:
Private Sub UserForm_Initialize()
TextBox1.MaxLength = 5
End Sub

Then you can use the following code to monitor the length of the text
that has been entered with the following code, and do what ever you
want if the condition is true.
Private Sub TextBox1_Change()
If Len(TextBox1.Value) = TextBox1.MaxLength Then
MsgBox "Max length reached: Cannot proceed any further."
TextBox2.SetFocus
End If

End Sub

Hope this helps.

Kind regards

Bernie Russell


--
Message posted via
http://www.officekb.com

 
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
Limiting the number of characters in a cell smartgal Excel Discussion (Misc queries) 5 September 10th 09 11:59 PM
Limiting a Column to "X" Number of Characters Wayne Excel Discussion (Misc queries) 2 June 26th 08 12:35 AM
Limiting a Column to "X" Number of Characters Wayne Excel Discussion (Misc queries) 3 June 25th 08 08:39 PM
Textbox: Number of Characters Bill[_30_] Excel Programming 1 July 2nd 06 10:12 PM
Limiting the number of characters in a cell. How? caliskier Excel Discussion (Misc queries) 3 January 12th 06 04:50 PM


All times are GMT +1. The time now is 10:37 PM.

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"