Option
Explicit
Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
Dim
trgZeile
As
Long
Dim
lngLaufZahl
As
Long
If
Target.Column <> 5
Then
Exit
Sub
If
Target.Row = 1
Then
Exit
Sub
Application.EnableEvents =
False
Application.ScreenUpdating =
False
With
ThisWorkbook
With
.Sheets(2)
.Activate
If
Target = 1
Then
trgZeile = .Cells(.Cells.Rows.Count, 1).
End
(xlUp).Row + 1
Target.EntireRow.Columns(
"A:D"
).Copy
.Cells(trgZeile, 1).
Select
Selection.PasteSpecial xlValues
.Cells(trgZeile, 1).
Select
ElseIf
Target = 0
Then
trgZeile = .Cells(.Cells.Rows.Count, 1).
End
(xlUp).Row
For
lngLaufZahl = 2
To
trgZeile
If
.Cells(lngLaufZahl, 1) = Target.Offset(0, -4)
Then
.Cells(lngLaufZahl, 1).EntireRow.Delete
Exit
For
End
If
Next
lngLaufZahl
Else
Target = 0
End
If
End
With
.Sheets(1).Activate
End
With
Application.SendKeys
"{ESC}"
Application.EnableEvents =
True
Application.ScreenUpdating =
True
End
Sub