textboxes problem?
1)
Private Sub ZipCode_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer )
With Me.Textbox1
Select Case True
Case (KeyCode = 96 And KeyCode < 105) 'numeric keypad
'exit quietly
Case (KeyCode = 48 And KeyCode < 57) 'normal keypad
'exit quietly
Case KeyCode = 8 'backspace
If Len(.Text) 0 Then
.Text = Left(.Text, Len(.Text) - 1)
End If
KeyCode = 0
Case KeyCode = 46 ' decimal point
Case Else
KeyCode = 0
Beep
End Select
End With
End Sub
2)
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim iPos As Long
With Me.TextBox1
iPos = InStr(1, .Text, ".")
If iPos 0 Then
If iPos < Len(.Text) - 2 Then
MsgBox "Invalid amount"
Cancel = True
End If
End If
End With
End Sub
3) What do you mean by '... without the change event code ...'? Why not just
set it to the other textbox value?
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Liedson31" wrote in message
...
hello everyone...
i have a few questions about textboxes and the answer is i suspect
simple...
--by code i know the answer but itīs the only option i have for this?
1) only let the user to insert numbers in a textbox (without code
isnumeric)
2) the textbox must be formated with 2 decimals (without
format(....,"0,00"))
3) 2 textboxes must have the same value so if i input in one of them letīs
say the number 5 the other must list 5(without the change event code)
thanks for any help
Miguel
|