Gruppe
Dialog
Bereich
TextBox
Thema
Eingabe von positiven Zahlen erzwingen
Problem
Wie kann ich die Eingabe von positiven Zahlen in eine UserFormTextBox erzwingen?
Lösung
Geben Sie den nachfolgenden Code in das Klassenmodul der UserForm ein.
ClassModule: Tabelle1
ClassModule: frmNurPositiv
Private Sub cmdContinue_Click()
Unload Me
End Sub
Private Sub txtValue_KeyDown( _
ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim sTxt As String
If KeyCode = 189 Then
KeyCode = 0
End If
End Sub
StandardModule: basMain
Sub CallForm()
frmNurPositiv.Show
End Sub