Remove extra drawing objects

A_Pitts

Board Regular
Joined
Sep 2, 2002
Messages
85
When the print macro is run, I copy and paste 3 different logos into my form based on the product class that is accepted. This works until the user changes his mind about the class. The original drawing object is still there.
Since they always paste to the same location, I'd like to make the first step be to just remove whichever one is there so that the new one can be pasted.

Here's what I'm doing:

If Range("I5").Value = "Product A" Then
ActiveSheet.Shapes("Picture 27").Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
Range("A1:J52").Select
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
Range("F7").Select

Any thoughts.
Thanks,
A_Pitts
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

A_Pitts

Board Regular
Joined
Sep 2, 2002
Messages
85
I've tried a lot of different ways, but Excel gives the drawing object a different picture number each time it pastes. And without the correct number or a way to remove all the objects from the paste area, I'm stumped.

Thanks,
A_Pitts
 

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
Basically, Name your Pictures via the namebox.
Activate & Copy your Pictures via these names.
Delete All othe Pictures that are not thes names via a select case statement.

Post back if help required..
 

A_Pitts

Board Regular
Joined
Sep 2, 2002
Messages
85
Thanks for the response.

I searched the help file and didn't find "namebox", how to use it, etc. The only thing I seem to be able to do is right click the object and rename the macro associated with it (There are none).
Also, could you post a small example of "Delete All of the Pictures that are not these names via a select case statement." I only have a dozen or so buttons to exclude so that should be doable. If it only references a specific location on the sheet, would I only have to include the names of the logos that I might paste there.
It's late here, so I'll check tomorrow.

Thanks,
A_Pitts
 

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
<SCRIPT language=JavaScript src="http://www.xcelfiles.com/popup.js"></SCRIPT>
Book1
ABCD
1<<NameBox
2
3
4
Sheet1


As for Code ... let me get some examples ... latter
 

Watch MrExcel Video

Forum statistics

Threads
1,127,180
Messages
5,623,216
Members
415,957
Latest member
Newguy1924

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top