I have some code that works well but I know it can be written much cleaner than what I have.
Sub DeleteField()
Range("A6").Select
Do
If ActiveCell.Value = "Actual Conveyable Cases" Or _
ActiveCell.Value = "Projected Non Con" Or _
ActiveCell.Value = "Actual Non Con Cases" Or _
ActiveCell.Value = "Projected CPT" Or _
ActiveCell.Value = "Actual CPT" Or _
ActiveCell.Value = "Projected Store Loads" Or _
ActiveCell.Value = "Actual Store Loads" Or _
ActiveCell.Value = "Projected Pull Ahead" Or _
ActiveCell.Value = "Actual Pull Ahead" Or _
ActiveCell.Value = "Projected Loads at 08:00" Or _
ActiveCell.Value = "Actual Loads at 08:00" Then
ActiveCell.EntireRow.Select
Selection.Delete
ActiveCell.Select
Else: ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = "" And ActiveCell.Offset(-5, 0).Value = ""
MsgBox "Done!"
End Sub
I am looking for a way to clean up the multiple Or statements. Is there a way that this can be accomplished with an array or perhaps some way to clean up all of teh “ActiveCell” segments
You can use a
SELECT CASEstatement to clean that up: