Dear respected Cousin Excel,
Good day! Thank you for posting to Microsoft Community. We are happy to help you.
As per your description, es, it is certainly possible to write a VBA macro for Excel that will delete all shapes within a selected range. Here's an example macro that you can use:
Sub DeleteShapesInRange()
**Dim shp As Shape**
**Dim rng As Range**
**Dim ws As Worksheet**
**Set ws = ActiveSheet**
**Set rng = Selection**
****
**For Each shp In ws.Shapes**
**If Not Intersect(shp.TopLeftCell, rng) Is Nothing Then**
**shp.Delete**
**End If**
**Next shp**
End Sub
This macro will iterate through all the shapes in the active sheet.
1.Press ALT + F11 to open the Visual Basic for Applications editor.
- Click Insert > Module to add a new module.
3.Copy the above VBA code and paste it into the module window.
4.Close the VBA editor.
5.To run the macro, press ALT + F8, select DeleteShapesInRange, and then click Run.
Appreciate your patience and understanding and thank you for your time and cooperation.
Sincerely,
Waqas Muhammad