Hi!
Weil Du hartnäckig bist, habe ich mal was gebastelt.
(Auch, damit Du siehst, was für ein Aufwand damit verbunden ist)
Der Monatsdropdown macht wenig Sinn, entweder Monat oder KW einstellen.
Ich habe es mit der KW gemacht.
Userform mit 2 Dropdowns und sieben Label für die Wochentage.
Ich habe schon Code in eine Function und eine Sub ausgelagert, sonst wäre es noch mehr ...
Option Explicit
Dim Montag As Date, b As Byte
Private Sub UserForm_Initialize()
With ComboBox1
.List = [index(year(today())-3+row(1:7),)]
.ListIndex = 2
End With
With ComboBox2
.List = [index(text(row(1:53),"00"),)]
.ListIndex = WorksheetFunction.WeekNum(Date, 21) - 1
Montag = Wochenstart(ComboBox1.Text, .Text)
End With
Call FillLabel
End Sub
Private Sub ComboBox1_Change()
If ComboBox2 = "" Then Exit Sub
Montag = Wochenstart(ComboBox1.Text, ComboBox2.Text)
Call FillLabel
End Sub
Private Sub ComboBox2_Change()
If ComboBox1 = "" Then Exit Sub
Montag = Wochenstart(ComboBox1.Text, ComboBox2.Text)
Call FillLabel
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Function Wochenstart(Jahr As String, KW As String) As Date
Wochenstart = DateValue("4.1." & Jahr) + KW * 7 - 7 - DateValue("2.1." & Jahr) Mod 7
End Function
Private Sub FillLabel()
For b = 0 To 6
Me.Controls("Label" & b + 3).Caption = Format(Montag + b, "ddd, dd.mm.yyyy")
Next
End Sub
Datei im Anhang.
Gruß Ralf