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

Calculating an Age On a Given Date

Start putting dates in a worksheet (especially birthdates), and sooner or later you will need to calculate an age based on ...

Discover More

Copying a Hyperlink to Lots of Worksheets

Copying information from one place to another in a worksheet is easy. Copying hyperlinks may not seem that easy, but you can ...

Discover More

Working with Master and Subdocuments

Word has long had the capability of establishing relationships between documents by designating some as master documents and ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Selecting a Specific Cell in a Macro

Need to use a macro to select a specific cell in a different workbook? It's not as straightforward of a proposition as you ...

Discover More

Using SUM In a Macro

Want to use a worksheet function (such as SUM) from within a macro? Here's how easy it is to accomplish the task.

Discover More

Understanding Variables in VBA Macros

You can create and use all sorts of variables in your macros. This tip examines all the different data types you can specify.

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 7 - 0?

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.