PC Review


Reply
Thread Tools Rate Thread

Deselect two objects after all selected

 
 
Cutter
Guest
Posts: n/a
 
      8th Aug 2004
Hello

Each week I copy a list of data from a web page and paste it into a
Excel worksheet. The data, However, includes dozens of small graphi
objects which I don't want so I have to delete them. I do this b
Edit>Go To>Special>Objects to select all objects on the sheet but
have to deselect two objects before hitting delete. I tried recordin
a macro for this but instead of showing a way to deselect the tw
objects it listed all of the others.

Is there a VBA equivalent to holding the shift key and clicking on th
two objects to deselect them from the selection? The two objects fo
deselection are named Picture 1 and Picture 2.

Thanks for any help you might have

--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
Myrna Larson
Guest
Posts: n/a
 
      8th Aug 2004
I don't know of any way to "deselect" something other than by selecting
something else.

I believe you need to use a loop to delete just the pictures you want. It
might look something like this:

Sub Macro1()
Dim Obj As Object
For Each Obj In ActiveSheet.DrawingObjects
Select Case Obj.Name
Case "Picture1", "Picture2"
'don't do anything
Case Else
Obj Delete
End Select
Next Obj
End Sub

PS: I used the macro recorder to get the code for selecting the objects on the
sheet. The line referred to ActiveSheet.DrawingObjects. When I put the cursor
on that word and pressed F1 to get help on the properties and methods, I got a
message about it being a hidden object, with no help available.


On Sat, 7 Aug 2004 19:25:28 -0500, Cutter
<<(E-Mail Removed)>> wrote:

>Hello
>
>Each week I copy a list of data from a web page and paste it into an
>Excel worksheet. The data, However, includes dozens of small graphic
>objects which I don't want so I have to delete them. I do this by
>Edit>Go To>Special>Objects to select all objects on the sheet but I
>have to deselect two objects before hitting delete. I tried recording
>a macro for this but instead of showing a way to deselect the two
>objects it listed all of the others.
>
>Is there a VBA equivalent to holding the shift key and clicking on the
>two objects to deselect them from the selection? The two objects for
>deselection are named Picture 1 and Picture 2.
>
>Thanks for any help you might have.
>
>
>---
>Message posted from http://www.ExcelForum.com/


 
Reply With Quote
 
Myrna Larson
Guest
Posts: n/a
 
      8th Aug 2004
Oops, I see a typo. The dot is missing between Obj and Delete, i.e. it should
be

Sub Macro1()
Dim Obj As Object
For Each Obj In ActiveSheet.DrawingObjects
Select Case Obj.Name
Case "Picture1", "Picture2"
'don't do anything
Case Else
Obj.Delete '<<<< ERROR HERE IN 1ST POST
End Select
Next Obj
End Sub


On Sat, 07 Aug 2004 19:47:07 -0500, Myrna Larson
<(E-Mail Removed)> wrote:

>I don't know of any way to "deselect" something other than by selecting
>something else.
>
>I believe you need to use a loop to delete just the pictures you want. It
>might look something like this:
>
>Sub Macro1()
> Dim Obj As Object
> For Each Obj In ActiveSheet.DrawingObjects
> Select Case Obj.Name
> Case "Picture1", "Picture2"
> 'don't do anything
> Case Else
> Obj Delete
> End Select
> Next Obj
>End Sub
>
>PS: I used the macro recorder to get the code for selecting the objects on

the
>sheet. The line referred to ActiveSheet.DrawingObjects. When I put the cursor
>on that word and pressed F1 to get help on the properties and methods, I got

a
>message about it being a hidden object, with no help available.
>
>
>On Sat, 7 Aug 2004 19:25:28 -0500, Cutter
><<(E-Mail Removed)>> wrote:
>
>>Hello
>>
>>Each week I copy a list of data from a web page and paste it into an
>>Excel worksheet. The data, However, includes dozens of small graphic
>>objects which I don't want so I have to delete them. I do this by
>>Edit>Go To>Special>Objects to select all objects on the sheet but I
>>have to deselect two objects before hitting delete. I tried recording
>>a macro for this but instead of showing a way to deselect the two
>>objects it listed all of the others.
>>
>>Is there a VBA equivalent to holding the shift key and clicking on the
>>two objects to deselect them from the selection? The two objects for
>>deselection are named Picture 1 and Picture 2.
>>
>>Thanks for any help you might have.
>>
>>
>>---
>>Message posted from http://www.ExcelForum.com/


 
Reply With Quote
 
Cutter
Guest
Posts: n/a
 
      8th Aug 2004
Myrna

Thank you very much for your reply. I'll give it a try

--
Message posted from http://www.ExcelForum.com

 
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
Help - my desktop is selected and I can't deselect it rkwriter Windows XP General 3 16th Aug 2009 11:52 PM
Deselect / Deactivate a selected picture Henk Microsoft Excel Programming 2 3rd Feb 2009 08:54 PM
Deselect objects from a selection JS Microsoft Powerpoint 4 9th Sep 2006 02:49 PM
how can I deselect one of the multiple selected rows? jopieb123 Microsoft Excel Misc 3 1st Dec 2005 03:50 PM
Deselect one of many non-adjacent rows selected =?Utf-8?B?Tmljb2xsZSBLLg==?= Microsoft Excel Misc 1 11th Jan 2005 06:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.