如圖,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, '程序執(zhí)行時間為:0.00秒'), 64, '時間統(tǒng)計' End Sub 方法1程序運行時間: 方法2:Sub 刪除2() Dim t t = Timer Sheet3.Columns('a').SpecialCells(xlCellTypeBlanks).EntireRow.Delete MsgBox Format(Timer - t, '程序執(zhí)行時間為:0.00秒'), 64, '時間統(tǒng)計' End Sub 方法2程序運行時間: 程序運行結(jié)果: |
|