QuantBurner
New Member
- Joined
- Jan 29, 2011
- Messages
- 42
Hi,
I have a macro that loops through all the shapes in an area. It selects the shape so the user can see what's been selected and then asks the user if he wants to keep it or not. This all works fine if I step through the code or execute from within VBA. However, if I run the macro via a button, nothing appears to be selected. So, how to I make the selected shape visible to the user?
Thanks!
Here's my code:
For Each shpShape In Activesheet.Shapes
If shpShape.Top >= dblTop And _
shpShape.Left >= dblLeft And _
shpShape.Left + shpShape.Width <= dblRight And _
shpShape.Top + shpShape.Height <= dblBottom Then
shpShape.Select
strKeepIt = MsgBox("Keep this text box?", vbQuestion + vbYesNo)
If strKeepIt = 7 Then shpShape.Delete
End If
Next shpShape
I have a macro that loops through all the shapes in an area. It selects the shape so the user can see what's been selected and then asks the user if he wants to keep it or not. This all works fine if I step through the code or execute from within VBA. However, if I run the macro via a button, nothing appears to be selected. So, how to I make the selected shape visible to the user?
Thanks!
Here's my code:
For Each shpShape In Activesheet.Shapes
If shpShape.Top >= dblTop And _
shpShape.Left >= dblLeft And _
shpShape.Left + shpShape.Width <= dblRight And _
shpShape.Top + shpShape.Height <= dblBottom Then
shpShape.Select
strKeepIt = MsgBox("Keep this text box?", vbQuestion + vbYesNo)
If strKeepIt = 7 Then shpShape.Delete
End If
Next shpShape