Lesson 23Advanced UserForms

Lesson 21 introduces UserForms and shows you how to add controls to your form. Lesson 22 provides several examples of UserForms with frequently used controls to help you gather and store information. This lesson takes an expanded look at how you can get more out of UserForms by tapping into their capacity for supporting some interesting and useful operations.

The UserForm Toolbar

The Visual Basic Editor has a handy toolbar for working with UserForms, aptly named the UserForm toolbar, shown in Figure 23.1. To display it in the VBE, from the menu bar click ViewToolbarsUserForm.

image

Figure 23.1

The UserForm toolbar has eight buttons:

  • Bring to Front: Brings the selected control to the front of the other controls.
  • Send to Back: Sends the selected control to the back of the other controls.
  • Group: Groups the selected controls.
  • Ungroup: Ungroups the selected grouped controls.
  • Alignments: The small drop-down arrow to the right of the Alignments icon provides options for aligning the selected controls by their Rights, Lefts, Centers, Tops, Middles, Bottoms, and To Grid.
  • Centering: Centers the selected controls horizontally or vertically on the UserForm.
  • Same ...

Get Excel VBA 24-Hour Trainer, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.