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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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