Datumsformat mit Makro
22.11.2005 13:42:24
Heribert
Wenn ich mit untenstehendem Makro das Datum in A7 schreibe,
bleibt 1.1.2005 trotz Formatierungscodezeile 1.1.2005
und nicht 01.01.2005.
Sicherlich mach ich hier was falsch, kann mal jemand nen Blick drauf werfen
Besten Dank, Heribert
Private Sub CommandButton1_Click()
If TextBox1.Value > 31 Or TextBox2.Value > 12 Or TextBox1.Value < 1 Or TextBox2.Value < 1 Then
TextBox1.SetFocus
Label1.Caption = "ungültige Eingabe"
Else
Range("A7").Value = (TextBox1.Value & "." & TextBox2.Value & "." & TextBox3.Value)
Range("A7").NumberFormat = "m/d/yyyy"
Unload Me
End If
End Sub