habe mal über Forum und Hilfe meines Vaters (leider nicht da) dieses Makro zusammengestellt.
Private Sub TextBox17_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Dim dteTmp As Date
If TextBox17 <> "mm-dd-yyyy" Then
On Error Resume Next
dteTmp = DateValue(TextBox17)
On Error GoTo 0
If dteTmp = 0 Then
Cancel = True
' MsgBox "Das ist kein Datum!"
MsgBox " Nur Datums-Eingabe erlaubt!", _
vbCritical, "Error !!!"
TextBox17 = "mm-dd-yyyy"
TextBox17.SetFocus
With TextBox17
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
Else
ActiveCell.Offset(0, 28) = Format(TextBox17.Text, "mm-dd-yyyy")
TextBox17.Text = ActiveCell.Offset(0, 28)
End If
End If
End Sub
Leider kann ich das Datum in der Textbox Nicht löschen, es kommt die Fehlermeldung (Hinweis) und dann
das Format: mm-dd-yyyy aber leider ist das Datum in der Zelle nicht gelöscht !
Was muß ich da ändern ?
Sonst klappt alles einwandfrei, nach der Eingabe wird das Datum Richtig als Datum auch angezeigt.
gruß Kurti