ich habe fogendes Problem und brauche eure Hilfe:
Folgender Code fügt das heutige Datum und die Kalenderwoche in die aktive Zelle ein:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim Bereich As Range
Cancel = True
Set Bereich = Range("C5:H43")
If Intersect(Target, Bereich) Is Nothing Then Exit Sub
ActiveCell.Value = Format(Date, "dd.mm.yyyy") & "/ " & KW(Date) & ". KW"
End Sub
Function KW(Datum As Date) As Integer
' Berechnt die KW nach DIN 1355
Dim t&
t = DateSerial(Year(Datum + (8 - Weekday(Datum)) Mod 7 - 3), 1, 1)
KW = (Datum - t - 3 + (Weekday(t) + 1) Mod 7) \ 7 + 1
End Function
Jetzt hätte ich aber gerne, dass die Angabe der Kalenderwoche in der Zelle Fett formatiert wird.
(Also ab: & KW(Date) & ". KW")
Gruß Dirk R.