View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default delete drwaings in a centain selection

Bartman,

Try something like the sub below.

HTH,
Bernie
MS Excel MVP


Sub DeleteShapes()
Dim myRange As Range
Dim myTop As Double
Dim myLeft As Double
Dim myRight As Double
Dim myBottom As Double
Dim mySh As Shape

Set myRange = Range(Range("A60"), Range("H60").End(xlDown))
myTop = myRange(1).Top
myLeft = myRange(1).Left
myRight = myRange(myRange.Count).Left + myRange(myRange.Count).Width
myBottom = myRange(myRange.Count).Top + myRange(myRange.Count).Height

For Each mySh In ActiveSheet.Shapes
If mySh.Top myTop And mySh.Top < myBottom Then
If mySh.Left myLeft And mySh.Left < myRight Then
mySh.Delete
End If
End If
Next mySh

End Sub



"bartman1980" wrote in message
oups.com...
I try to delete all the drawings in a certain selection.

sub deletedrawings()
Range("A60:H60").Select
Range("H60").Activate
Range(Selection, Selection.End(xlDown)).Select
activecells.DrawingObjects(1).Delete
Selection.ClearContents
end sub

But I get an error with the line
activecells.DrawingObjects(1).Delete