Remove background image with VB

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,023
I have created a process where I use a background image and then add multiple text in various cells. I do this for about 10 sheets on a regular basis.
When I have to to rerun the process, I have to manually delete the background on each sheet first since the image name increments each time to a new one

Is there a way to simply "remove background image if it exists"
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I don't know the direct code, but surely you could find it out by recording yourself removing the background image.

Then, if there is the possibility that there will be no background image to remove, you can include the line

Code:
on error resume next

after you have included the recorded instruction of removing the background image.


Hope this helps

Patrick
 
Upvote 0
When one records the delete of a background it looks like this

ActiveSheet.Shapes("Picture 49").Select
Selection.Delete

The problem is that the actual name "Picture 49" will be "Picture 50" the next time, etc. It is different on each sheet.

I need to find out how the get that name and then substitute that into the select statement
 
Upvote 0
Ah right, i'm with you.

Well you could iterate through the workbooks shapes collection... are the shapes that are the background the only objects with "Picture" starting the name?

If so, we could iterate through activesheet.shapes and simply delete all images on the sheet.
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,183
Members
448,872
Latest member
lcaw

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
Back
Top