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

Resizing Checkboxes

Written by Allen Wyatt (last updated May 15, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


1

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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2282) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) 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

Determining if Overtype Mode is Active

Your macro may need to determine if the user has overtype mode turned on. You can find out the overtype status easily by ...

Discover More

Accurately Setting Tabs Using the Ruler

If you try to set tabs by clicking on the Ruler, you may not be able to set them exactly where you want. This is normally ...

Discover More

Moving from Sheet to Sheet

Need to move quickly through the worksheets in a workbook? Learn the keyboard shortcuts and you can make short work of ...

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 (menu)

Making a Cell's Contents Italics within a Macro

You can use macros to process information in your worksheets. You may want to use that macro to apply the italic ...

Discover More

Using InputBox to Get Data

Need your macro to get some input from a user? The standard way to do this is with the InputBox function, described in ...

Discover More

Conditionally Displaying a Message Box

You can, from within your macros, easily display a message box containing a message of your choice. If you want to ...

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}] (all 7 characters, in the sequence shown) 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 minus 1?

2022-07-29 04:57:55

Nia

Hi Allen, hope you read this soon.
I just tried your trick and it works wonderfully.
However I need to create multiple labels, but when I copy paste the label, the vba doesn't adjust to the new label's name.
Is there a way to copy paste the label along with the vba so I don't have to edit vba on each label?
Thanks a lot!


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.