Range("A1:C7").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Application.CutCopyMode = False
Selection.EntireRow.Delete
End Sub
这是用于删除空白行的已记录VBA宏的一部分,但它在行Run time error "1004" - "cannot use that command on overlapping selection"
中显示错误Selection.EntireRow.Delete
。
什么似乎是问题?
答案 0 :(得分:1)
一个简单的循环示例:
Dim rgCol As Range
On Error Resume Next
For Each rgCol In Range("A1:C7").Columns
rgCol.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Next rgCol