Trouble With Deleting Shapes From A Worksheet

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a worksheet with 4 macro embedded shapes on it. I'm am trying to get code to work that will delete two of the 4, but I'm not having any luck.

Code:
    Dim Shp as Shape
    With wb2.Worksheets(1)
        .Unprotect
        For Each Shp In ActiveSheet.Shapes
            If Shp.Name = "Group12" Then Shp.Delete
            If Shp.Name = "Group3" Then Shp.Delete
        Next Shp
        .Protect
    End With

The loop is not finding any shapes named Group12 or Group3. I'm not entirely sure how to find their names. Their macro names are "'18-19 Materials Track.xlsm'!SRF_Group12_Click" and "'18-19 Materials Track.xlsm'!Group5_Click" respectively.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Found my errors!! Group 12, not Group12 etc.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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