简体   繁体   English

EXCEL VBA重叠错误

[英]EXCEL VBA overlap error

    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 . 这是已记录的VBA宏的一部分,用于删除空白行,但在Selection.EntireRow.Delete行中显示错误Run time error "1004" - "cannot use that command on overlapping selection"

What seems to be the problem? 似乎是什么问题?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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