AW: Ist es so schwer...
21.10.2014 09:10:26
{Boris}
Hi Jens,
Option Explicit
Sub mach_x()
Dim x As Long, y As Long, lngLastrow As Long
Dim datMatchDate As Date
On Error GoTo Err_Handler
datMatchDate = Range("AP1") 'Hier steht das Vergleichsdatum
lngLastrow = Cells(Rows.Count, 6).End(xlUp).Row ' Letzte Zeile anhand Spalte F ermitteln
'alle x entfernen
Range("K4:K10000, R4:R10000, Y4:Y10000, AF4:AF10000, AM4:AM10000").ClearContents
For x = 6 To 34 Step 7 'Schleife über die Spalten F, M, T etc...
For y = 4 To lngLastrow 'Schleife von Zeile 4 bis zur letzten Zeile
If Month(Cells(y, x)) = Month(datMatchDate) And Year(Cells(y, x)) = Year(datMatchDate) _
_
Or Month(Cells(y, x + 1)) = Month(datMatchDate) And Year(Cells(y, x + 1)) = Year(datMatchDate) _
Then
Cells(y, x + 5) = "x"
End If
Next y
Next x
Exit Sub
Err_Handler:
MsgBox "Irgendwas hat nicht gepasst...", vbInformation, "Es ist nicht alles erledigt..."
End Sub
VG, Boris