如图,A列中有许多空白行,需要把它们删除 方法1:Sub 删除1() Dim t t = Timer Dim i As Long For i = 1000 To 1 Step -1 If Cells(i, 1) = '' Then Cells(i, 1).EntireRow.Delete End If Next MsgBox Format(Timer - t, '程序执行时间为:0.00秒'), 64, '时间统计' End Sub 方法1程序运行时间: 方法2:Sub 删除2() Dim t t = Timer Sheet3.Columns('a').SpecialCells(xlCellTypeBlanks).EntireRow.Delete MsgBox Format(Timer - t, '程序执行时间为:0.00秒'), 64, '时间统计' End Sub 方法2程序运行时间: 程序运行结果: |
|