指定範囲内の図形(オブジェクト)削除
初めて質問します。
Excelで指定した範囲内に存在する図形を削除できないかシナリオを検索中です。
VBAだと楽なのですが、、
Dim myRng As Range ’(シナリオの範囲選択を活用時はrange = scell&":"&ecell?)
Dim SHP As Object
With ActiveSheet
Set myRng = .Range("A1:BG14") ’scell = !開始セル!ecell = !終了セル!でいければ。。
For Each sp In .Shapes
If Not Intersect(.Range(sp.TopLeftCell, sp.BottomRightCell), myRng) Is Nothing Then
sp.Delete
End If
Next
End With
Set myRng = Nothing
スクリプトでshape(1).deleteで削除はできましたが、範囲選択外にあってもそれを選んでしまうのであきらめました。
ご協力よろしくお願いします。