Datumseingabe auch 8stellig
12.04.2005 09:18:51
Gisela
in einem Worksheet-Change formatiere ich die Datumseingabe. Das funktioniert auch u.a. bei einer Eingabe von 6 Stellen, z.B.020505 = 02.05.05. Ich möchte, dass es auch bei der Eingabe von 02052005 = 02.05.05, funktioniert. Was muss ich ändern?
Teilauszug:
'Datum in den Spalten F und G
Set ZielBereich = Application.Intersect(Range("F:G"), Target)
If ZielBereich Is Nothing Then Exit Sub
a = Target.Value
If IsDate(a) = True Then
ActiveSheet.Unprotect ("mix1877")
Application.EnableEvents = False
Target.Value = Format(a, "dd.mm.yy")
Application.EnableEvents = True
ActiveSheet.Protect ("mix1877")
Exit Sub
End If
If IsNumeric(a) = False Then Exit Sub
If a 999999 Then Exit Sub
a = Format(a, "000000")
t = Mid(a, 1, 2)
m = Mid(a, 3, 2)
j = Mid(a, 5, 2)
a = DateSerial(j, m, t)
Application.EnableEvents = False
Kann mir jemand helfen?
Vielen Dank für jeden Tipp.
Grüße
Gisela