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

Improper Index Page Numbers

Adding an index to a document can be a nice finishing touch, particularly if the document is a long one. What happens if the ...

Discover More

Understanding Styles

Styles are a key concept in Microsoft Word. If you understand styles, you will find it much easier to use Word effectively.

Discover More

Adding Video to a Slide

Videos can be an important element of any presentation. Google Presentation makes it easy to add YouTube videos to any ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Counting the Times a Worksheet is Used

Do you need to know how many times a worksheet has been used? Excel doesn't track that information, but you can develop some ...

Discover More

Getting a File Name

Does your macro need to allow the user to specify a particular file name that should be used by the macro? Here's a quick ...

Discover More

Recovering Macros from Corrupted Workbooks

Workbooks get corrupted from time to time; that's a fact of life in an Excel world. If those corrupted workbooks contain ...

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. 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 + 5?

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.