Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii Case 45 'negative If Len(Trim(TextBox1.Text)) 1 Then Beep KeyAscii = 0 End If Case 46 'period If InStr(TextBox1.Text, ".") 0 Then Beep KeyAscii = 0 End If Case 48 To 57 'numbers If InStr(TextBox1.Text, ".") 0 Then If Len(TextBox1.Text) InStr(TextBox1.Text, ".") + 1 Then Beep KeyAscii = 0 End If End If Case Else 'Discard anything else Beep KeyAscii = 0 End Select End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Amit" wrote in message ... I have made a user form consisting of various Text Boxes. Can I control the entry type in the Box? eg I would like that only integers be entered in the Text Box. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is Visual Basic the same as Visual Studio 2008? | Excel Worksheet Functions | |||
Make visual basic truely visual! | Excel Programming | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Excel/Visual Basic | Excel Programming |