Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am unable to enter more that one character (2.00 but not 26.00) in a
textbox. I have the format set to ###.00 in another procedure. I think this is the procedure that is causing the problem. Is there a format length in here? Private Sub TextBox80_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case Asc("0") To Asc("9") If InStr(1, Me.TextBox80.Text, "$") 0 Or Me.TextBox80.SelStart 0 Then KeyAscii = 0 End If Case Asc(".") If InStr(1, Me.TextBox80.Text, ".") 0 Then KeyAscii = 0 End If Case Else KeyAscii = 0 End Select End Sub Thanks, James |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This seems to work
Private Sub TextBox80_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case Asc("0") To Asc("9") If InStr(1, Me.TextBox80.Text, "$") 0 Then KeyAscii = 0 End If Case Asc(".") If InStr(1, Me.TextBox80.Text, ".") 0 Then KeyAscii = 0 End If Case Else KeyAscii = 0 End Select End Sub -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "KD" wrote in message oups.com... I am unable to enter more that one character (2.00 but not 26.00) in a textbox. I have the format set to ###.00 in another procedure. I think this is the procedure that is causing the problem. Is there a format length in here? Private Sub TextBox80_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case Asc("0") To Asc("9") If InStr(1, Me.TextBox80.Text, "$") 0 Or Me.TextBox80.SelStart 0 Then KeyAscii = 0 End If Case Asc(".") If InStr(1, Me.TextBox80.Text, ".") 0 Then KeyAscii = 0 End If Case Else KeyAscii = 0 End Select End Sub Thanks, James |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Any ideas what could be causing this limitation? I am confounded.
Here is the formatting procedure. I trigger a set focus before calling so that the user sees formatting consistently. Private Sub TextBox80_Exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox80 < "" Then TextBox80.Value = Format(Me.TextBox80.Value, "###.00") Else TextBox80.Value = Format(Me.TextBox80.Value, "0") End If End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It was the selstart statement.
Bob: Thanks for your time. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Textbox Question | Excel Programming | |||
Textbox question | Excel Discussion (Misc queries) | |||
Textbox question | Excel Programming | |||
textbox question | Excel Programming | |||
Textbox question 2 | Excel Programming |