I have multiple buttons on a worksheet. Under some of the buttons is an oval or rectangular shape. When the user selects a button I am removing any text from the button and making the button not visible.
I also want to delete the oval or rectangle shape that is at the location of the button.
The following code runs and does not error out - everything works except it does not find the oval or rectangle in the range specified. Thoughts? Suggestions?
Set r = ActiveSheet.Shapes(Application.Caller).TopLeftCell
Set r2 = ActiveSheet.Shapes(Application.Caller).BottomRightCell
ActiveSheet.Buttons(Application.Caller).Text = ""
ActiveSheet.Shapes(Application.Caller).Visible = False
Set rngDataArea = Range(Cells(r.Row, r.Column), Cells(r2.Row, r2.Column))
For Each shpShape In ActiveSheet.Shapes
If Not (Intersect(shpShape.TopLeftCell, rngDataArea) Is Nothing) _
Then
'Shape is in the data area to be cleared.
If shpShape.TextFrame.Characters.Text = "L/M" Or shpShape.TextFrame.Characters.Text = "EQUIP" Then
shpShape.Delete
End If
End If
Next shpShape
Bookmarks