Excel VBA:删除整行,如果列A中的单元格为空(长数据集) [英] Excel VBA: Delete entire row if cell in column A is blank (Long Dataset)
问题描述
我正在尝试删除长数据集中的列A中具有空白单元格的所有行(excel中超过60 000行)。我有一个VBA代码当我少于aprox 32 000个单元格时,效果会很好:
Sub DelBlankRows()
有没有人知道某种方式可以在大量行上工作?
列A:A)。选择
Selection.SpecialCells(xlCellTypeBlanks)。选择
Selection.EntireRow.Delete
End Sub
谢谢你
解决方案您可以尝试:
Application.ScreenUpdating = False
列(A:A)。SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True
Application.ScreenUpdating
切换代码中所做的更新是否对用户可见,并尝试列(A:A)。SpecialCells(...
可能会节省时间,因为它不' t实际上必须选择单元格 - 未经测试。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 tryingColumns("A:A").SpecialCells(...
might save time because it doesn't actually have to select the cells - untested.这篇关于Excel VBA:删除整行,如果列A中的单元格为空(长数据集)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!