Forum Discussion
nic-nicol
Jan 16, 2021Copper Contributor
Trying to toggle colour of shapes on mouse click
I'm putting shapes over a picture of a human body so you can click an area, say upper left leg, and it's highlighted, click again returns to transparent so you just see the picture below. I've go...
- Jan 17, 2021
You need only a single macro that you assign to all the shapes:
Sub ChangeFill() With ActiveSheet.Shapes(Application.Caller).Fill .Visible = Not .Visible End With End SubPlease note that when the interior of a shape is transparent, you'll have to click on its edge to run the macro; clicking inside the shape won't work (precisely because it is transparent).
nic-nicol
Jan 17, 2021Copper Contributor
Have set it up with nice fill colours, outline etc, all working perfectly.
only thing is, you mentioned I can't alter the size/position of the click area for each shape, is it possible to make the click area visible?
HansVogelaar
Jan 17, 2021MVP
The clickable area of a shape is the visible part:
- If the border is visible, the border is clickable.
- If the border is transparent, it is not clickable.
- If the interior is visible, the interior is clickable.
- If the interior is transparent, it is not clickable.
So what you see is what you get...
- nic-nicolJan 17, 2021Copper Contributor
Gotcha!! Solved it by increasing the outline of the shape to make it easier to hit.
Thanks again 🙂