ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TextBox Values (https://www.excelbanter.com/excel-programming/368941-textbox-values.html)

Abdul[_2_]

TextBox Values
 
Hello!,

How I can limit textbox (or combo) from accepting only numbers and
Minimum is zero and maximum is Number of days in a specific month?

say for eg. In comboBox1 i select february then textBox1 shoul accept
only from 0 to 28 or in case of april 0 to 30, May 0 to 31 etc...

based on the value in textbox1 textbox2 is calculated, so textbox1
should not be allowed to be empty to avoid an error

thanks


raypayette[_36_]

TextBox Values
 

The simplest way for beginners is to validate the data once it is
entered.
Private Sub TextBox1_Change()
t = TextBox1.Text
If Not IsNumeric(t) Then MsgBox "Non numeric character "
End Sub

For experts, each keystroke can be monitored.


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566924



All times are GMT +1. The time now is 07:21 PM.

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