Hello,

I have code below which, as of now, correctly deletes rows based on criteria mentioned in other sheets in the same workbook.

I.e, the code looks at column B for a document number. If that document number is contained anywhere in the previous sheets, the entire row containing that document number is deleted.

The problem I am having is that if all the criteria is mentioned previously in other sheets, no rows are deleted. Please see the code below and suggest how I can fix it. I want the code to basically leave a blank sheet instead of not deleting any rows.

Please let me know if I can clarify:

    Sheets("Misc").Select
    k = 2
    Do While k <= Sheets("Upcoming").Range("B65536").End(xlUp).Row
        cnt = 0
        For Each ws In ActiveSheet.Parent.Worksheets
            If ws.Name = ActiveSheet.Name Then Exit For
            cnt = cnt + Application.WorksheetFunction.CountIf(ws.Range("B:B"), ActiveSheet.Range("B" & k).Value)
            If cnt > 0 Then Exit For
        Next ws
        If cnt > 0 Then
            ActiveSheet.Rows(k).Delete
        Else
            k = k + 1
        End If
    Loop
    Range("A1").Select