Remove shape in specific range

FilleFrella44

New Member
Joined
Oct 11, 2022
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm new to the forum. I've got a sheet where there sometimes exists shapes which cannot be targeted by the mouse (there are several different ones, they're not all the same shape).

I want to be able to remove them anyway, however I want to also control which ones I remove since some of them I still want in the sheet.

Hence, I am trying a code where I can remove shapes based on the selected area in the Excel Sheet. Currently I've come to this code (with inspiration from other forumposts):

Sub Remove_Shapes_In_Range()

Dim shp As Shape, i As Long

'This is just to make the user select the range themselves (i.e. me)
Set myRng = Application.InputBox( _
prompt:="Select a cell or range or cells", Type:=8)
Debug.Print myRng.Address 'remove when you are happy

'Here I try to remove the shape in the selected range
If shp.myRng Then shp.Delete

End Sub
 
Thank you RoryA, that was exactly what I was looking for. I'm looking forward to spending more time on this forum, have a nice rest of your week!
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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