Macro : Delete/Remove Only 4 Pictures..

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,216,731
Messages
6,132,395
Members
449,725
Latest member
Enero1

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