Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Resizing Checkboxes.

Resizing Checkboxes

by Allen Wyatt
(last updated October 21, 2016)

7

When working in VBA, one of the things you can create is known as a "user form." These forms provide you with the ability to essentially create your own dialog boxes. You can add many different types of controls to a user form, if desired. For instance, you can add labels, text boxes, drop-down lists, radio buttons, and many other controls. Some of the controls you can resize; others you cannot. One that you cannot resize is a checkbox. While you can modify the font size used for the label next to the checkbox, you cannot resize the checkbox itself.

If you find the checkboxes in your user forms too small for your taste, you can "work around" them by simulating a checkbox. You do this by actually creating a label instead of a checkbox. Then, change the properties of the label so that it has a transparent background, and that the font being used is Wingdings. You should also make sure that the font is set to a large size, such as 20 or 26 points.

Now, double-click on your label, which should open a code window. The event that you are programming is the Click event for the label, which means it will be executed whenever the label is clicked. Use this as your code:

Private Sub Label1_Click()
    If Label1.Caption = Chr(254) Then
        Label1.Caption = Chr(168)
    Else
        Label1.Caption = Chr(254)
    End If
End Sub

In the Wingding font, Chr(254) is box with a checkmark, and Chr(168) is a box with no checkmark. When you execute the user form and click on the label, it switches between an empty box and a checked box. You can also add other code to the Click event that performs other tasks, as necessary.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8566) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Resizing Checkboxes.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Making All Occurrences Bold

Want to make instances of a given word or phrase bold throughout a worksheet? Here's a way you can make the change quickly.

Discover More

Sorting Tabular Tables

Some people like to format simple tables using tabs instead of using Word's table editor. When it comes time to sort such ...

Discover More

Getting a Word Count

It is often helpful to know how many words you've typed in a document. Perhaps you have a target word count, or you can't go ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Displaying the First Worksheet in a Macro

When creating macros, you often have to know how to display individual worksheets. VBA provides several ways you can display ...

Discover More

Forcing a Macro to Run when a Worksheet is Recalculated

Normally a macro is only calculated when you specifically tell Excel to calculate it. Some macros need to be calculated ...

Discover More

Develop Macros in Their Own Workbook

If you develop macros and edit them quite a bit, you may be running the risk of causing problems with the macros or with your ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine more than 8?

2015-07-14 07:57:05

Murray

Me again. I Googled the issues I was having and mine was by no means an isolated case. Throw in virtual desktops and things can get ugly very fast. I ended up going back to good 'ol form controls rather than ActiveX. Yes, they are pretty basic, but they do the basics reliably. With a few techniques, you can pretty much achieve the same results. I wish the ActiveX controls worked better, because they look a lot better...


2015-07-13 22:41:28

Murray

A couple of things I noticed.
Firstly the code on this page is identical to the other page for Excel 2003. I was looking to use this with a customer with a mixed environment (2003/2010). There is no clear difference indicated in the implementation. Secondly, for no apparent reason after resizing the boxes a little I found that after each click the font got smaller and smaller till it was no longer possible to see the checkbox, let alone click on it. Toggling the autosize property restores the proper size, but then it diminishes back to nothing when out of design mode.


2015-03-25 09:43:32

Roger

I think I found the solution to my problem. http://stackoverflow.com/questions/27411399/microsoft-excel-activex-controls-disabled


2015-03-23 16:12:01

Roger

This works great when I first do it. However, when I save the workbook and re-open it, it no longer functions. Clicking on the label control no longer has any effect, and I can't add another one on the sheet. I've tried several times; Moved the code fromthe sheet to a standard module; Checked the trust settings (Office 2010); Saved the workbook as xlsm, xlsb, and xls; None of them work when re-opened. When I try to change the properties, I get the sheet properties instead.


2015-01-09 16:19:35

Marc

Got it! Thanks for this workaround, it's great!!


2015-01-09 16:13:02

Marc

I have created this code as recommended but the item that appears in the label is the actual symbol that would appear in the bar above when the wingding is normally used, not the box with or without the check mark. So the checked box is actually a lower case b with a tail on the bottom and the unchecked box looks like a colon. Is there a fix for this?


2014-09-04 13:16:51

Kenneth

Can someone please explain this step by step so the average Joe can understand this. Thank you


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.