Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim cDots As Long
Private Sub txtRank_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) If cDots 1 Then MsgBox "Too manuy dots" Cancel = True End If End Sub Private Sub txtRank_Change() cDots = Len(txtRank.Text) - Len(Replace(txtRank.Text, ".", "")) End Sub Private Sub txtRank_Enter() cDots = 0 End Sub '--------------------------------------------------------------------------- Private Sub txtRank_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) '--------------------------------------------------------------------------- Select Case KeyAscii Case Asc("0") To Asc("9"): 'OK Case Asc("."): cDots = cDots + 1 Case Else: KeyAscii = 0 End Select End Sub -- HTH RP (remove nothere from the email address if mailing direct) "bforster1" wrote in message ... I have a created a financial model which includes TextBoxes for the user to input certain assumptions. If the user does not input a number in TextBoxes, which are inserted in the spreadsheet, the program creates a error. For example, if the user enters ".50" it works fine but if the user enters "..50" by accident it causes a debug error. How can i protect from this happening? Thanks -- bforster1 ------------------------------------------------------------------------ bforster1's Profile: http://www.excelforum.com/member.php...o&userid=11771 View this thread: http://www.excelforum.com/showthread...hreadid=274486 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime error textbox problem - help required | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
Textbox error checK problems | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |