ich habe folgendes Problem:
und zwar hab ich in Excel in der Spalte L13 --> als Formel "DATUM(Zuweisung!$B$2;1;1)" stehen M13 dann "L13 + 1" usw.
Die Zellen sind alle als Datum formatiert.
Über die Userform Textbox1 und Texbox2 will ich das Datum finden.
Die Suchfunktion funktioniert nur wenn das Datum nicht per Formel hinterlegt ist.
Ich komme hier nicht weiter, kann mir einer helfen wie ich das hinbekomme wenn das Datum als Formel hinterlegt ist.
Hier ist der Quellcode dazu:
Private Sub CommandButton2_Click()
Dim str_mitarbeiter As String
Dim dat_von As Date
Dim dat_bis As Date
Dim str_kuerzel As String
Dim obj_wks_ziel As Worksheet
Dim lng_spalte_von As Long
Dim lng_spalte_bis As Long
Dim rng_fund As Range
Dim lng_zeile As Long
Dim lng_zaehler As Long
str_mitarbeiter = Me.ComboBox1
dat_von = TextBox1
dat_bis = TextBox2
str_kuerzel = Me.ComboBox2
Set obj_wks_ziel = ThisWorkbook.Worksheets("Urlaubsplanner")
With obj_wks_ziel
For lng_zaehler = 4 To .Cells(.Rows.Count, 4).End(xlUp).Row
If .Cells(lng_zaehler, 4) = str_mitarbeiter Then
lng_zeile = lng_zaehler
End If
Next
Set rng_fund = .Rows(13).Find(dat_von, LookIn:=xlValues, lookat:=xlWhole)
If Not rng_fund Is Nothing Then
lng_spalte_von = rng_fund.Column
End If
Set rng_fund = .Rows(13).Find(dat_bis, LookIn:=xlValues, lookat:=xlWhole)
If Not rng_fund Is Nothing Then
lng_spalte_bis = rng_fund.Column
End If
For lng_zaehler = lng_spalte_von To lng_spalte_bis
If Weekday(.Cells(13, lng_zaehler)) 1 And Weekday(.Cells(13, lng_zaehler)) 7 Then
.Cells(lng_zeile, lng_zaehler) = str_kuerzel
Cells(lng_zeile, lng_zaehler).Select
End If
Next
End With
Unload Me
End Sub
Textbox1 und 2 habe ich so formatiert:
Private Sub TextBox1_AfterUpdate()
TextBox1 = Format(TextBox1, "DD.MM.YYYY")
End Sub