1
我想構建一個可以過濾和刪除大約35,000行的代碼。篩選並刪除整行
我用下面的代碼,但它需要很多時間(超過10分鐘),任何人都可以請幫助我更快?
代碼1:
Range("$A$1:$S$50000").AutoFilter Field:=19, Criteria1:="Delete"
ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).Delete (xlShiftUp)
代碼2:
Dim RngToDelete As Range
Range("$A$1:$S$50000").AutoFilter Field:=19, Criteria1:="Delete"
Set RngToDelete = Selection.SpecialCells(xlCellTypeVisible)
RngToDelete.Delete
感謝, Amith
[Excel VBA性能 - 1百萬行 - 在1分鐘內刪除包含值的行]可能出現重複(http://stackoverflow.com/questions/30959315/excel-vba-performance-1-million- rows-delete-rows-containing-a-value-in-less) –
你已經'application.screenupdating = FALSE'了嗎?這將節省大量的時間。 –
是的,我曾經使用過 - application.screenupdating = FALSE –