Nun möchte ich gern den Anwender aufzuforden mindestens 5 Ziffern einzugeben, ansonsten
soll die Textbox wieder selektiert werden.
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If IsNumeric(TextBox1) = False And TextBox1 "" Then
MsgBox "Sie dürfen nur Ziffern eingeben, " & Chr(13) & Chr(13) & _
"bitte denken SIE daran, 5 stellige Eingabe !!! ", _
vbCritical, "Error !!!"
TextBox1 = Left(TextBox1, Len(TextBox1) - 1)
TextBox1 = "00000"
TextBox1.SetFocus
With TextBox1
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
End Sub
Private Sub TextBox1_AfterUpdate()
If TextBox1.Value = "" Then
TextBox1.Value = "00000"
End If
ActiveCell.Offset(0, 0) = TextBox1.Value
TextBox1 = ActiveCell.Offset(0, 0).Value
TextBox1.SetFocus
With TextBox1
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
gr KURT P