FilleFrella44
New Member
- Joined
- Oct 11, 2022
- Messages
- 20
- Office Version
- 365
- Platform
- 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
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