Excel VBATutorial                      


Excel VBA Macros

Email to excel-vba.com

Excel Tutorial on Macros

 Excel Consulting

Here is a sample of what you will find in lesson 31 of the downloadable Tutorial on Excel macros

Lesson 31 on Excel macros (VBA):

Option Buttons, Check Boxes and Frames

In the toolbox the option button  has this icon   VBA for Excel Option buttons icon, the check box has this one VBA for Excel check box icon and, the frame this one VBA for Excel frame icon.

You do not need to add a label to accompany the check box or the option button because they come with their own.

The check boxes and the option buttons are both used to offer the user  a choice. The main difference between check boxes and option buttons is that if you have 5 of each  on a form a user can check all 5 check boxes but can only select one of the option buttons.

If you want to create two sets of option buttons read below on frames and option buttons. If you do not want to use frames to create groups of option buttons you will need to use the "GroupName" property of the option buttons. All option buttons with the same GroupName work together.


- WordWrap to be able to write more that one line in the caption,
- ControlTipText which generates a small comment box when the user moves the mouse over the control. You can use this property to give explanations and instructions about the option  button or the check box.
- Enabled and Visible are properties that you can change programmatically to disable or render invisible an option button or a check box following a previous selection in another control of the userform.


Frames are also a passive control. Frames are used to improve the layout of the userform. You can use them around a group of controls  that have something in common.

Frames become more important to manage option buttons. If you have two sets of option buttons on a userform and you do not place them within a frame they all work together and you can choose only one. If you put each set within a frame you can choose one in each set.

When you move a frame all its controls move with it.

We hope you have enjoyed this introduction to lesson 31
for more on this topic and a complete course on Excel macros download the
Tutorial on Excel Macros

Next Lesson: Excel Spin Buttons