I have code that is not working, but it is close. This code is supposed to delete rows based on a value in column B. If the row does not have that value, delete it. Nothing happens when I run it, though if I change the “does not equal” function to “equals”, it deletes the rows that have the referenced values. Why wont this code do the opposite when I put <> in place of =?
Dim arcArray As Variant
Dim d As Integer
arcArray = Array(“Tanker Offer Data”, “Truck Offer Data”, “Pipeline Offer Data”, “Barge & SDraft Offer Data”, “Offeror Max Monthly”)
Dim ws5 As Worksheet
For Each arcSheet In arcArray
sheets(arcSheet).Select
lastrow = sheets(arcSheet).Range("B" & Rows.Count).End(xlUp).Row
Range("B6:B" & lastrow).Select
For d = 6 To lastrow
If ActiveCell.Value <> ActiveSheet.Range("E1").Value Then
ActiveCell.EntireRow.Delete
End If
Next d
Next arcSheet