Option Explicit
Option Compare Text
Dim lr As Long, lc As Long, i As Long
Dim ws As Worksheet
Dim a, b
Sub Multiple_Sheets()
Application.ScreenUpdating = False
Products
Brands
Display
Application.ScreenUpdating = False
End Sub
Sub Products()
Set ws = Worksheets("Sponsored Products")
lr = ws.Cells.Find("*", , xlFormulas, , 1, 2).Row
lc = ws.Cells.Find("*", , xlFormulas, , 2, 2).Column + 1
a = Range(ws.Cells(2, 1), ws.Cells(lr, lc))
ReDim b(1 To UBound(a), 1 To 1)
'***CHANGE YOUR CRITERIA IN THIS BLOCK***
For i = 1 To UBound(a)
If Not a(i, 2) Like "*Keyword*" And _
Not a(i, 2) Like "*Product Targeting*" And _
Not a(i, 11) Like "*enabled*" Then b(i, 1) = 1
Next i
ws.Cells(2, lc).Resize(UBound(a)) = b
i = WorksheetFunction.Sum(ws.Columns(lc))
Range(ws.Cells(2, 1), ws.Cells(lr, lc)).Sort Key1:=ws.Cells(2, lc), order1:=1, Header:=2
If i > 0 Then ws.Cells(2, lc).Resize(i).EntireRow.Delete
End Sub
Sub Brands()
Set ws = Worksheets("Sponsored Brands")
lr = ws.Cells.Find("*", , xlFormulas, , 1, 2).Row
lc = ws.Cells.Find("*", , xlFormulas, , 2, 2).Column + 1
a = Range(ws.Cells(2, 1), ws.Cells(lr, lc))
ReDim b(1 To UBound(a), 1 To 1)
'***CHANGE YOUR CRITERIA IN THIS BLOCK***
For i = 1 To UBound(a)
If Not a(i, 2) Like "*Keyword*" And _
Not a(i, 2) Like "*Product Targeting*" And _
Not a(i, 11) Like "*enabled*" Then b(i, 1) = 1
Next i
ws.Cells(2, lc).Resize(UBound(a)) = b
i = WorksheetFunction.Sum(ws.Columns(lc))
Range(ws.Cells(2, 1), ws.Cells(lr, lc)).Sort Key1:=ws.Cells(2, lc), order1:=1, Header:=2
If i > 0 Then ws.Cells(2, lc).Resize(i).EntireRow.Delete
End Sub
Sub Display()
Set ws = Worksheets("Sponsored Display")
lr = ws.Cells.Find("*", , xlFormulas, , 1, 2).Row
lc = ws.Cells.Find("*", , xlFormulas, , 2, 2).Column + 1
a = Range(ws.Cells(2, 1), ws.Cells(lr, lc))
ReDim b(1 To UBound(a), 1 To 1)
'***CHANGE YOUR CRITERIA IN THIS BLOCK***
For i = 1 To UBound(a)
If Not a(i, 2) Like "*Keyword*" And _
Not a(i, 2) Like "*Product Targeting*" And _
Not a(i, 11) Like "*enabled*" Then b(i, 1) = 1
Next i
ws.Cells(2, lc).Resize(UBound(a)) = b
i = WorksheetFunction.Sum(ws.Columns(lc))
Range(ws.Cells(2, 1), ws.Cells(lr, lc)).Sort Key1:=ws.Cells(2, lc), order1:=1, Header:=2
If i > 0 Then ws.Cells(2, lc).Resize(i).EntireRow.Delete
End Sub