删除特定数据下面的空白行

我需要一个脚本(Excel VBA),可以在下面的电子表格删除一个空白行,在“星期一”出现的地方 – 任何人都可以帮忙吗?

在下面的例子中,我需要星期一在一起(没有空行)

name Monday 02 05 16 name Monday 02 05 16 name Monday 02 05 16 name Monday 02 05 16 name Tuesday 03 05 16 name Tuesday 03 05 16 

尝试这个

 Option Explicit Sub MAIN() Dim cell As Range Dim mondaysAddress As String With Worksheets("MyWS") '<~~ replace "MyWS" with you actual worksheet name For Each cell In .Columns("A").SpecialCells(xlCellTypeConstants, xlTextValues)'<~~ replace "A" with whatever column cells you must search the word "Monday" in If InStr(UCase(cell.Value), "MONDAY") Then If IsEmpty(cell.Offset(1)) Then mondaysAddress = mondaysAddress & cell.Offset(1).Address & "," End If Next cell mondaysAddress = Left(mondaysAddress, Len(mondaysAddress) - 1) Range(mondaysAddress).EntireRow.Delete End With End Sub