Advanced controls in userforms with VBA macros
Part one of a nine-part series of blogs

The two previous parts of this mini-blog have shown how to draw forms and how to write code to handle form events. This final part shows how to add some of the more exotic controls to user forms, like combo boxes, list boxes, multipage controls, spinners and option buttons.

  1. Advanced Controls - Our Example (this blog)
  2. Multipage Controls
  3. Combo boxes (and list boxes)
  4. Multiple Column Combo Boxes and Listboxes
  5. Multi-select ListBoxes
  6. SpinButtons (Spinners)
  7. Check Boxes
  8. Option Buttons (Radio Buttons)
  9. The Calendar Control

This blog is part of our Excel VBA tutorial.  Wise Owl's main business is running Excel, VBA and other courses for businesses.

Posted by Andy Brown on 28 February 2012 | 4 comments

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Advanced Controls - Our Example

I'm going to assume that you've already read my two previous blogs on user forms, namely:

The aim of this blog is to show you how to work with combo boxes, list boxes and the like.

A Souped-Up Drink Order Form

The examples in this blog will all refer to the following form:

Example form with lots of controls

One of the three pages of the form is shown here.

 

You can download the workbook containing this example user form, complete with all the attached code.

 

This blog has 4 comments

Comment added on 02 October 2012 at 02:41 GMT
I was looking at the option boxes and got stuck when you went to the me.option..... I keep getting an invalid use of me error message. I am not sure if you defined it somewhere up above or what. I would use a combo box but I have been trying to figure out option boxes just to know how to use them if I did and I think they look cleaner
Reply from Andy Brown
You're probably trying to use Me to refer to the current form, but doing it within a code module (in which case Me would actually refer to the active Excel workbook).
Comment added on 24 December 2012 at 13:20 GMT
Cheers Andy
Have been struggling with userform multipages & yours is the best article I've seen by miles.
I only program now and again and like to construct my code in the same manner as you.
Putting the bouncers on the door making sure the correct information is in the right place.

Cheers
          Bernie
  
Comment added on 27 December 2012 at 07:42 GMT
I'm not finding the calendar in my list of additional controls?  Thoughts?
Reply from Andy Brown
Choose Tools from the menu in VBA, choose Additional Controls...   and tick the Calendar Control 11.0 (or whatever number appears after it) in the list.  This should reference the required calendar control.  While you're there, you could have a look at the hundreds of other add-ins!
Comment added on 03 October 2013 at 19:40 GMT
I am not seeing any calendar options under the "additional controls" list.  What do I need to do to get this installed??  Is there a module or something that can be installed or downloaded from the web?
Reply from Andy Brown
Try choosing Tools => Additional Controls... from the menu, to see if you can find it in the list.

A full-blown discussion forum is being built for this site, which will allow you once more to add comments and discussion threads.