J
John Michl
I have eight shapes on a sheet. I'd like to be able to click on a
shape and if its zorder is 1, bring it to the front. If not, send it
to the back. The following code does this but I must name each shape
and have a chunck of code for each shape.
How can I genericize this so that whatever shape is clicked, it will
change order?
Sub ToggleOrder()
If ActiveSheet.Shapes("NameOfShape").ZOrderPosition <= 1 Then
ActiveSheet.Shapes("NameOfShape").ZOrder msoBringToFront
Else
ActiveSheet.Shapes("NameOfShape").ZOrder msoSendToBack
End If
End Sub
- John
shape and if its zorder is 1, bring it to the front. If not, send it
to the back. The following code does this but I must name each shape
and have a chunck of code for each shape.
How can I genericize this so that whatever shape is clicked, it will
change order?
Sub ToggleOrder()
If ActiveSheet.Shapes("NameOfShape").ZOrderPosition <= 1 Then
ActiveSheet.Shapes("NameOfShape").ZOrder msoBringToFront
Else
ActiveSheet.Shapes("NameOfShape").ZOrder msoSendToBack
End If
End Sub
- John