【发布时间】:2016-04-27 19:13:47
【问题描述】:
我正在尝试根据不包含特定条件的行删除整行,这是我目前拥有的:
Sub Delete_consultants()
Last = Cells(Rows.Count, "H").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "H").Value) = "Faith Jones" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Cathy Robbs" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Nick farmer" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Jane Till" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Jack White" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Dylan Smith" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Emma Long" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Nick Winter" Then
Cells(i, "A").EntireRow.Delete
End If
If (Cells(i, "H").Value) = "Niel West" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub
问题是这目前正在删除我想保留的人。但我不知道如何删除其他我发现的所有帖子只有 1 或 2 个标准,你可以在我需要 9 的地方设置!另外,如果可能的话,我似乎无法解决,如果包含这些名称的行从 DirectLink 移动到 Infomation(它们在同一个工作簿中)。
【问题讨论】:
标签: vba excel delete-row