PC Review


Reply
Thread Tools Rate Thread

delete drwaings in a centain selection

 
 
bartman1980
Guest
Posts: n/a
 
      26th Oct 2007
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 With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      26th Oct 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2007, Selection.Delete deletes more than the selection xlrotor Microsoft Excel Programming 5 3rd Mar 2008 11:36 PM
delete drawings in a centain selection bartman1980 Microsoft Excel Programming 4 26th Oct 2007 11:23 AM
Copy Selection - Paste Selection - Delete Selection Uninvisible Microsoft Excel Programming 2 25th Oct 2007 01:31 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Microsoft Excel Misc 2 23rd Oct 2007 04:18 PM
For anyone who can access centain web pages Iche Windows XP Internet Explorer 0 26th Aug 2003 04:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:24 PM.