Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default delete drwaings in a centain selection

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete a selection flirtacious Charts and Charting in Excel 2 November 25th 07 01:57 PM
Problem of selection.delete Radhakrishna k.v.n.r[_2_] Excel Worksheet Functions 7 October 27th 07 11:50 AM
Copy Selection - Paste Selection - Delete Selection Uninvisible Excel Programming 2 October 25th 07 01:31 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Delete blank rows in selection Jim Thomlinson[_5_] Excel Programming 0 February 13th 06 08:40 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"