起始行为3,起始列为B,终止列为R
Sub 去除空白行()
For x = 3 To Range("B65536").End(xlUp).Row
If Cells(x, 2) = "" Then
For y = x To Range("B65536").End(xlUp).Row
If Cells(y, 2) <> "" Then
'Stop
Range(Cells(x, 2), Cells(x, "r")).Value = Range(Cells(y, 2), Cells(y, "r")).Value
Range(Cells(y, 2), Cells(y, "r")).ClearContents
Exit For
End If
Next y
End If
Next x
End Sub
执行后会将空白行删除~
网友评论