AW: Kalenderwoche
14.03.2005 12:09:48
loe
Hallo
Private Sub Calendar1_Click()
UserForm1.Label1.Caption = KW(Calendar1.Value) & " Kalenderwoche"
End Sub
Function KW(d As Date) As Integer
t = DateSerial(Year(d + (8 - Weekday(d)) Mod 7 - 3), 1, 1)
KW = (d - t - 3 + (Weekday(t) + 1) Mod 7) \ 7 + 1
End Function
Private Sub CommandButton1_Click()
ActiveCell.Value = UserForm1.Calendar1.Value
ActiveCell.Offset(0, 1).Value = UserForm1.Label1.Caption
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Call Calendar1_Click
End Sub
Private Sub UserForm_Initialize()
UserForm1.Calendar1.Year = Year(Date)
UserForm1.Calendar1.Month = Month(Date)
UserForm1.Calendar1.Day = Day(Date)
UserForm1.Label1.Font.Bold = True
UserForm1.Label1.ForeColor = RGB(255, 0, 0)
End Sub
Gruß
loe