简体   繁体   中英

Excel VBA: Delete entire row if cell in column A is blank (Long Dataset)

I am trying to delete all rows that have blank cells in column A in a long dataset (over 60 000 rows in excel)

I have a VBA code that works great when I have less then aprox 32 000 cells:

   Sub DelBlankRows()

   Columns("A:A").Select
   Selection.SpecialCells(xlCellTypeBlanks).Select
   Selection.EntireRow.Delete

   End Sub

Does anybody know a way so that it works on a large number of rows?

Thank you

You could try:

Application.ScreenUpdating = False
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True

Application.ScreenUpdating toggles whether updates made in code are visible to the user, and trying Columns("A:A").SpecialCells(... might save time because it doesn't actually have to select the cells - untested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM