我有一些运行良好的代码,但我知道它可以写得比我所拥有的要干净得多。
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
我正在寻找一种清理多个 Or 语句的方法。有没有一种方法可以通过数组或某种方法来清理所有“ActiveCell”段