Sub
ZeilenLoeschen()
Dim
sh1
As
Object
, sh2
As
Object
, found, zeile
As
Long
Set
sh1 = ThisWorkbook.Sheets(
"Tabelle1"
)
Set
sh2 = ThisWorkbook.Sheets(
"Tabelle2"
)
zeile = sh1.Cells(Rows.Count, 1).
End
(xlUp).Row
If
ActiveCell.Row > zeile
Then
Exit
Sub
zeile = ActiveCell.Row
Set
found = sh2.Range(
"A:A"
).Find(what:=sh1.Cells(zeile, 1), lookat:=xlWhole)
If
Not
(found
Is
Nothing
)
Then
sh1.Rows(zeile).Delete shift:=xlUp
sh2.Rows(found.Row).Delete shift:=xlUp
End
If
End
Sub