Trouble With Deleting Shapes From A Worksheet

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,570
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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Found my errors!! Group 12, not Group12 etc.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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