delete drawings in a centain selection
Sub deletedrawings()
Dim rngTop As Double
Dim rngBottom As Double
Dim rngLeft As Double
Dim rngRight As Double
Dim shp
'Sheets("Resultaat").Select
With Range("A60:H60")
rngTop = .Top
rngBottom = rngTop + .Height
rngLeft = .Left
rngRight = rngLeft + .Width
For Each shp In ActiveSheet.DrawingObjects
If shp.Top <= rngBottom And shp.Top + shp.Height = rngTop And _
shp.Left <= rngRight And shp.Left + shp.Width = rngLeft
Then
shp.Delete
End If
Next shp
.ClearContents
End With
End Sub
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"bartman1980" wrote in message
ups.com...
I tried to delete all the drawings in a certain selection.
sub deletedrawings()
Sheets("Resultaat").Select
Range("A60:H60").Select
Range("H60").Activate
Range(Selection, Selection.End(xlDown)).Select
activecells.DrawingObjects(1).Delete
Selection.ClearContents
end sub
But he gives an error on the line:
activecells.DrawingObjects(1).Delete
Note: searching and fine the drawing isn't an option because this is
totally random.
I just want to delete all drawings ans cells in the selection I made.
|