Macro : Delete/Remove Only 4 Pictures..

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,102
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all...

i have 5 pictures in a sheet..i want remove only 4 pict...
how do make it in macros..
here this code but delete all pict..

Code:
Sub Kill_Pictures()For Each Shape In ActiveSheet.Shapes
If Left(Shape.Name, 7) = "Picture" Then
 Shape.Delete
End If
Next
End Sub

i would like someone help me.

this attachment file :
https://app.box.com/s/335mvkore06iypb560mr1dw34fca771z

thanks a lot before...

m.susanto
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Like this?

Code:
Sub Kill_Pictures()
For Each Shape In ActiveSheet.Shapes
If Shape.Name = "Picture 9" Or Shape.Name = "Picture 10" Or Shape.Name = "Picture 11" Or Shape.Name = "Picture 12" Then
 Shape.Delete
End If
Next
End Sub

Or

Code:
Sub Kill_Pictures()For Each Shape In ActiveSheet.Shapes
If Shape.Name <> "Picture 1" Then
 Shape.Delete
End If
Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

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