PC Review


Reply
Thread Tools Rate Thread

Delete all objects on sheet except...

 
 
=?Utf-8?B?Sk5X?=
Guest
Posts: n/a
 
      22nd Aug 2007
I know I can use ActiveSheet.DrawingObjects.Delete to delete all drawing
objects on a sheet.

Is there a way to select all drawing objects EXCEPT for charts and text
boxes (or anything else for that matter)?
--
JNW
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      22nd Aug 2007
I have use this code before:

for each myshape in shapes

if instr(ucase(myshape.name),"CHART") = 0 then

msgbox(myshape.name)
end if

run code above once to make surre you are happy with the results. Then add

myshape.delete into the code.

"JNW" wrote:

> I know I can use ActiveSheet.DrawingObjects.Delete to delete all drawing
> objects on a sheet.
>
> Is there a way to select all drawing objects EXCEPT for charts and text
> boxes (or anything else for that matter)?
> --
> JNW

 
Reply With Quote
 
=?Utf-8?B?Sk5X?=
Guest
Posts: n/a
 
      22nd Aug 2007
Joel

Thanks for the reply. I'm not quite understanding what your code does. And
it is erroring at the for next line.

Thanks.
--
JNW


"Joel" wrote:

> I have use this code before:
>
> for each myshape in shapes
>
> if instr(ucase(myshape.name),"CHART") = 0 then
>
> msgbox(myshape.name)
> end if
>
> run code above once to make surre you are happy with the results. Then add
>
> myshape.delete into the code.
>
> "JNW" wrote:
>
> > I know I can use ActiveSheet.DrawingObjects.Delete to delete all drawing
> > objects on a sheet.
> >
> > Is there a way to select all drawing objects EXCEPT for charts and text
> > boxes (or anything else for that matter)?
> > --
> > JNW

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      22nd Aug 2007
Sub test()
Dim nType As Long
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
nType = shp.Type
Select Case nType
Case msoChart, msoTextBox
' inlcude "or anything else for that matter" not to delete
Case Else
shp.Delete
End Select
Next
End Sub

Regards,
Peter T


"JNW" <(E-Mail Removed)> wrote in message
news:5E5773CE-2103-4433-A9E1-(E-Mail Removed)...
> I know I can use ActiveSheet.DrawingObjects.Delete to delete all drawing
> objects on a sheet.
>
> Is there a way to select all drawing objects EXCEPT for charts and text
> boxes (or anything else for that matter)?
> --
> JNW



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      22nd Aug 2007
You can use Type

See this page for a few examples
http://www.rondebruin.nl/controlsobjectsworksheet.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"JNW" <(E-Mail Removed)> wrote in message news:5E5773CE-2103-4433-A9E1-(E-Mail Removed)...
>I know I can use ActiveSheet.DrawingObjects.Delete to delete all drawing
> objects on a sheet.
>
> Is there a way to select all drawing objects EXCEPT for charts and text
> boxes (or anything else for that matter)?
> --
> JNW

 
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
Delete 1 row of objects, not all on sheet Excel 2007 Paula Microsoft Excel Misc 11 6th Oct 2009 05:40 PM
Re: delete hyperlinks from graphical objects in excel sheet NickHK Microsoft Excel Programming 0 27th Sep 2005 06:03 AM
Re: delete hyperlinks from graphical objects in excel sheet Dave Peterson Microsoft Excel Programming 4 22nd Sep 2005 02:22 PM
Re: How to delete all graphical objects in a sheet Ken Wright Microsoft Excel Programming 0 23rd Mar 2004 06:46 PM
Re: How to delete all graphical objects in a sheet Ron de Bruin Microsoft Excel Programming 0 23rd Mar 2004 06:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:54 PM.