I have a list of dates in Column A (Sheet1) and I would like to delete the entire row that matches any of the holidays dates found in Sheet2. For example:
Dates(Column A,Sheet1)
23/12/2019
24/12/2019
25/12/2019
26/12/2019
27/12/2019
28/12/2019
29/12/2019
Holidays(Column A,Sheet2)
25/12/2019
26/12/2019
After running the code, the rows containing 25th and 26th of December in Sheet 1 should be deleted. Also, there may be months when there are no holidays to be deleted. Any help would be appreciated.
I have tried the code below. The loop seems to be working, but for some reason no rows are being deleted
With Sheets("Sheet1")
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 7 Step -1
If Not IsError(Application.Match(Sheets("Sheet1").Range("A"& i).Value,
Sheets("Sheet2").Columns("A"), 0)) Then
Sheets("Sheet1").Rows(i).Delete
Next i
End With