Private Sub Worksheet_Change(ByVal Target As Range)
Set NewTarget = Intersect(Target, Range("A:A"))
If NewTarget Is Nothing Then
Set NewTarget = Intersect(Target, Range("L:L"))
If NewTarget Is Nothing Then Exit Sub
Cells(Target.Row, "M") = Now
Exit Sub
End If
If Cells(Target.Row, "A").Value <> "" Then
Cells(Target.Row, "C") = Now
Cells(Target.Row, "D") = Now
Else
Cells(Target.Row, "C") = ""
Cells(Target.Row, "D") = ""
End If
End Sub
'Rauheit muss geprüft werden
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LastRow As Long
Dim i As Long
Dim Name As String
Dim Week As Integer
Dim FirstDate As Date
Dim Found As Boolean
' Überprüfen, ob Änderungen in Spalte E vorgenommen wurden
If Target.Column <> 5 Then Exit Sub
' Letzte Zeile in Spalte E finden
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
' Für jede neue Zeile in Spalte E
For i = Target.Row To LastRow
' Name in Spalte E
Name = Cells(i, "E").Value
' Datum in Spalte C
FirstDate = Cells(i, "C").Value
' Kalenderwoche des Datums
Week = Format(FirstDate, "ww")
' Überprüfen, ob der Name bereits in dieser Kalenderwoche aufgetaucht ist
Found = False
For j = 10 To i - 1
If Cells(j, "E").Value = Name And Format(Cells(j, "C").Value, "ww") = Week Then
Found = True
Exit For
End If
Next j
' Wenn der Name das erste Mal in dieser Kalenderwoche aufgetaucht ist
If Not Found Then
' Nachricht in Spalte J schreiben
Cells(i, "J").Value = "nötig "
End If
Next i
End Sub