Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deselect two objects after all selected

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
EditGo ToSpecialObjects 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Deselect two objects after all selected

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
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
EditGo ToSpecialObjects 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/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Deselect two objects after all selected

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
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
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
EditGo ToSpecialObjects 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/


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deselect two objects after all selected

Myrna

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

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

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
Hide Selected Objects Clara Excel Worksheet Functions 4 June 28th 09 06:00 AM
formula 2 display selected objects ONLY in new sheet from another Andrew Langner Excel Worksheet Functions 1 February 5th 09 01:31 AM
How to deselect a selected chart programatically? sr152 Charts and Charting in Excel 3 January 28th 06 03:22 AM
how can I deselect one of the multiple selected rows? jopieb123 Excel Discussion (Misc queries) 3 December 1st 05 03:50 PM
Deselect one of many non-adjacent rows selected Nicolle K. Excel Discussion (Misc queries) 1 January 11th 05 06:24 PM


All times are GMT +1. The time now is 06:51 AM.

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

About Us

"It's about Microsoft Excel"