Hi selixc
Try this Code...
Option Explicit
Sub LoopAllSheetsInOpenWorkbooks()
Dim wb As Workbook
Dim sht As Worksheet
Application.ScreenUpdating = False
For Each wb In Application.Workbooks
If wb.Name <> "PERSONAL.xlsb" Then
For Each sht In wb.Worksheets
With sht
.Sort.SortFields.Add Key:=Range("F2:F20000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.Sort.SortFields.Add Key:=Range("D2:D20000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With .Sort
.SetRange Range("A2:F20000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
If Not .AutoFilterMode Then
.Rows("1:1").AutoFilter
End If
.Range("A1:F20000").AutoFilter Field:=6, Criteria1:="=LEP", _
Operator:=xlOr, Criteria2:="="
.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
Next sht
End If
Next wb
Application.ScreenUpdating = True
End Sub
Bookmarks