Custom Checkbox control in Excel

J

Jim

Hello, I have a user who is asking if it is possible to create a custom
checkbox control for use inside of Excel. This new checkbox control is
essentially a checkbox control that has other graphics around the checkmark
other than a square.

For instance, he need to have a triangle that has a clickable checkmark
inside it. He needs a circle with a clickable checkmark inside as well as a
couple of other shapes that have a clickable checkmark inside (no square
around the checkbox). I've tried to put a regular checkbox on top of a
graphic but you have to deal with the square corners of the checkbox even if
it's set to transparent.

Anyone seen any code or otherwise on how to create a custom or add-in that
would do what I describe?

Thanks
Jim
 
D

Dick Kusleika

Jim

Create a circle (oval) from the Drawing Toolbar. Format the autoshape
(right click) and set the font to Wingdings (and the size and boldness to
suit) and set the alignment to Center for both horizontal and vertical.

Paste this code into a standard module

Sub CheckCircle()

With Sheet1.Shapes(1).TextFrame
If .Characters.Text = Chr$(252) Then
.Characters.Text = ""
Else
.Characters.Text = Chr$(252)
End If
End With

End Sub

Right click on the autoshape and choose "assign macro" and assign
CheckCircle to it. Whenever you click the circle, a check mark should
appear and disappear alternately. You can also experiment with different
fonts and different numbers in the Chr$() function to find a check mark more
to your liking.
 
Joined
Nov 20, 2017
Messages
1
Reaction score
0
Dick -

Your code is amazing. Though I'm having trouble applying the code to multiple shapes instead of just 1. I need various check boxes throughout with the same functionality. Any feedback would be appreciated!

- Gen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top