W
will_never_read
Dear Excel Users
I have several Shapes on a worksheet. I want the fill colour to toggle
between two values whenever the shape is clicked. I've assigned the
following Macro to a shape with the following code:
-------------------
Sub Macro1()
ActiveSheet.Shapes("AutoShape 1").Select
Call Toggle
End Sub
Sub Toggle()
If Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
Range("A1").Select 'so that the shape is "deselected"
End Sub
-------------------
The problem is that I need a new macro (based on Macro1) for EVERY
shape which calls the Toggle routine when clicked.
Can I assign just one Macro to ALL shapes which will toggle the colour
of the ONE shape I click on (i.e. is not specific to a given
shape/group)?
Many thanks
jw
I have several Shapes on a worksheet. I want the fill colour to toggle
between two values whenever the shape is clicked. I've assigned the
following Macro to a shape with the following code:
-------------------
Sub Macro1()
ActiveSheet.Shapes("AutoShape 1").Select
Call Toggle
End Sub
Sub Toggle()
If Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
Range("A1").Select 'so that the shape is "deselected"
End Sub
-------------------
The problem is that I need a new macro (based on Macro1) for EVERY
shape which calls the Toggle routine when clicked.
Can I assign just one Macro to ALL shapes which will toggle the colour
of the ONE shape I click on (i.e. is not specific to a given
shape/group)?
Many thanks
jw