Ich habe unterstehende Code an einen Formular mit der Datum - Steuerelement gehängt.
Alles funktioniert prima, aber leider kommt nicht der Datum dass in die Zelle A1 steht, wenn nicht des heutige Datum. Immer 5 März 2002
Was kann hier die Fehler sein?
---------------------
Option Explicit
Private Sub cmdClose_Click()
' Close the UserForm
Unload Me
End Sub
Private Sub frmCalendar_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Calendar1.Value
Unload Me
Range("A1").Select
End Sub