2017-09-18 4 views
-3

以前に選択した行を削除するマクロを作成したいとします。VBAの条件を満たしている行を削除する方法

行11または12を選択しない限り、マクロ全体を削除する必要があります。その場合は、行の内容を削除して書式を保持したいだけです。あなたはwith selection.cells(1)への複数行選択変更with selection上に複数行の削除を回避したい場合

おかげ

答えて

1

は、

with selection 
    if not intersect(.cells, .parent.range("11:12")) is nothing then 
     .cells.entirerow.clearcontent 'use .clear if you want to strip formatting as well 
    else 
     .cells.entirerow.delete 
    end if 
end with 

を試してみてください。

関連する問題