【发布时间】:2019-07-11 20:41:18
【问题描述】:
此代码删除仅在 D 列中包含“服务塔”一词的所有行。
我想删除更多包含“流播放”、“数据集”的行,以及更多包含这些文本的行,无论它们是在列 a、b 还是 c 到 z。
Sheets("database").Select
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Rows(2).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
For Lrow = Lastrow To Firstrow Step -1
With .Cells(Lrow, "D")
If Not IsError(.Value) Then
If .Value = "Service Tower" Then .EntireRow.Delete
End If
End With
Next Lrow
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
MsgBox "Report Completed!"
End Sub
【问题讨论】: