Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hey everyone...quick question....is there a way to limit a textbox on form to only accept numbers? I don't want a user to be able to ente any characters except 0-9.. -- dok11 ----------------------------------------------------------------------- dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058 View this thread: http://www.excelforum.com/showthread.php?threadid=38231 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way... and I sure there is a more excel type way is
this will allow decimal point also Private Sub textbox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If CheckBox2.Value = True Then If KeyAscii 47 And KeyAscii < 58 Then ' 0 to 9 KeyAscii = KeyAscii ElseIf KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46 Then ' backspace and enter keys KeyAscii = KeyAscii Else KeyAscii = 0 End If End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
forgot the checkbox part as I added that to give option of number only or
alphas |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dok112,
See: http://tinyurl.com/cp6oh and http://tinyurl.com/8rnvr --- Regards, Norman "dok112" wrote in message ... Hey everyone...quick question....is there a way to limit a textbox on a form to only accept numbers? I don't want a user to be able to enter any characters except 0-9... -- dok112 ------------------------------------------------------------------------ dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581 View this thread: http://www.excelforum.com/showthread...hreadid=382315 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Character limit in textbox | Excel Worksheet Functions | |||
Defining character limits | Excel Worksheet Functions | |||
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys | Excel Programming | |||
Limits on Userform textbox | Excel Programming | |||
how to put tab character into textbox? | Excel Programming |