Reputation: 11
Range("A1:C7").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Application.CutCopyMode = False
Selection.EntireRow.Delete
End Sub
This is part of a recorded VBA macro for deleting blank rows but it's showing an error Run time error "1004" - "cannot use that command on overlapping selection"
in the line Selection.EntireRow.Delete
.
What seems to be the problem?
Upvotes: 1
Views: 5349
Reputation: 34085
A simple loop example:
Dim rgCol As Range
On Error Resume Next
For Each rgCol In Range("A1:C7").Columns
rgCol.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Next rgCol
Upvotes: 1