簡體   English   中英

EXCEL VBA重疊錯誤

[英]EXCEL VBA overlap error

    Range("A1:C7").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Application.CutCopyMode = False
    Selection.EntireRow.Delete 
End Sub

這是已記錄的VBA宏的一部分,用於刪除空白行,但在Selection.EntireRow.Delete行中顯示錯誤Run time error "1004" - "cannot use that command on overlapping selection"

似乎是什么問題?

一個簡單的循環示例:

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