The the attached sheet with this macro. I used worksheet formulas and the AutoFilter to delete all the rows at once, should be peppy enough.
Option Explicit
Sub Delete3SheetMatches()
'Jerry Beaucaire 5/6/2010
'Delete rows that match equal values on all 3 sheets
'https://sites.google.com/a/madrocketscientist.com/jerrybeaucaires-excelassistant/system/app/pages/sitemap/hierarchy
Dim ws1 As Worksheet: Set ws1 = Sheets("MAS90")
Dim ws2 As Worksheet: Set ws2 = Sheets("MT")
Dim ws3 As Worksheet: Set ws3 = Sheets("TEDD")
Dim LR1 As Long: LR1 = ws1.Range("A" & Rows.Count).End(xlUp).Row
Dim LR2 As Long: LR2 = ws2.Range("A" & Rows.Count).End(xlUp).Row
Dim LR3 As Long: LR3 = ws3.Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
On Error Resume Next
'Put in keys for matching easily
ws1.Range("AA2:AA" & LR1).FormulaR1C1 = "=RC1 & "" "" & RC3"
ws2.Range("AA2:AA" & LR2).FormulaR1C1 = "=RC2 & "" "" & RC3 & "" "" & RC7"
ws3.Range("AA2:AA" & LR3).FormulaR1C1 = "=RC2 & "" "" & RC3 & "" "" & RC5"
With ws1.Range("AB2:AB" & LR1)
.FormulaR1C1 = _
"=AND(COUNTIF(C27,RC27)=COUNTIF(MT!C27,RC27),COUNTIF(C27,RC27)=COUNTIF(TEDD!C27,RC27))"
.Value = .Value
End With
ws1.Range("AB1") = "key"
With ws3
.Range("AB1") = "key"
.Range("AB2:AB" & LR3).FormulaR1C1 = _
"=INDEX(MAS90!C28, MATCH(RC27, MAS90!C27, 0)) = TRUE"
.Range("AB:AB").AutoFilter Field:=1, Criteria1:="TRUE"
LR3 = .Range("A" & .Rows.Count).End(xlUp).Row
If LR3 > 1 Then .Range("AB2:AB" & LR3).EntireRow.Delete xlShiftUp
.AutoFilterMode = False
.Range("AA:AB").ClearContents
End With
With ws2
.Range("AB1") = "key"
.Range("AB2:AB" & LR2).FormulaR1C1 = _
"=INDEX(MAS90!C28, MATCH(RC27, MAS90!C27, 0)) = TRUE"
.Range("AB:AB").AutoFilter Field:=1, Criteria1:="TRUE"
LR2 = .Range("A" & .Rows.Count).End(xlUp).Row
If LR2 > 1 Then .Range("AB2:AB" & LR2).EntireRow.Delete xlShiftUp
.AutoFilterMode = False
.Range("AA:AB").ClearContents
End With
With ws1
.Range("AB:AB").AutoFilter Field:=1, Criteria1:="TRUE"
LR1 = .Range("A" & .Rows.Count).End(xlUp).Row
If LR1 > 1 Then .Range("AB2:AB" & LR1).EntireRow.Delete xlShiftUp
.AutoFilterMode = False
.Range("AA:AB").ClearContents
End With
Application.ScreenUpdating = True
End Sub
Bookmarks