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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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