Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
Please help below trying to say if 2 cells in same row = specific values then delete row.
VBA Code:
ElseIf (CellI) Like "* + collection*" And (CellJ) Like "*askwh*" Then
Option Explicit
Public intDeleteNonBO As Integer
Sub DeleteAnyNonBO()
Dim wb As Workbook
Dim ws As Worksheet
Dim CellI As String, Col As String, CellJ As String
Dim LRow As Long
Dim i As Integer, x As Integer
intDeleteNonBO = 0
With Application
.ScreenUpdating = False
.Calculation = xlManual
.DisplayAlerts = False
.EnableEvents = False
End With
Set wb = Workbooks("2024BackOrderReport.xlsm")
Set ws = wb.Worksheets("Data")
LRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = LRow To 2 Step -1
On Error Resume Next
Col = "A"
CellI = LCase(ws.Cells(i, 9).Value)
CellJ = LCase(ws.Cells(i, 10).Value)
If IsDate(ws.Cells(i, Col).Value) And ws.Cells(i, Col).Value = Date Then
If CellI Like "no space" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf CellI Like "*fit on*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf CellI Like "*bag not*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf CellI Like "*loading picking error*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*no room*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*no more room*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*error*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*failed*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf CellI Like "*Not Picked*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf CellI Like "*Not Loaded*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*no space*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*wouldn`t fit*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*wrong site*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*driver forgot*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*driver didn`t*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*Would not fit on Truck*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "*Vehicle at capacity*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellI) Like "* & collection*" And (CellJ) Like "*askwh*" Then
ws.Cells(i, "A").EntireRow.Delete
ElseIf (CellJ) Like "*fr*" Then
ws.Cells(i, "A").EntireRow.Delete
End If
End If
Next i
intDeleteNonBO = 1
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.DisplayAlerts = True
.EnableEvents = True
End With
End Sub