Excel like a finance pro.
VBA · User interaction
UserForms
Custom dialog boxes with text boxes, dropdowns, and buttons.
When to use it
UserForms are custom dialog boxes with labels, text boxes, dropdowns, checkboxes, and buttons. They are the way to collect several inputs at once or to build a small app inside Excel.
The code
- Code
UserForm1.Show
Worked examples
Show a form
Insert > UserForm, add a ComboBox and a CommandButton, then UserForm1.Show → The dialog appears
Design in the editor, show from code.
Handle a button
Private Sub CommandButton1_Click() Range("B1").Value = ComboBox1.Value Unload Me End Sub → Writes the selection to the sheet and closes
Button code lives in the form module.
Populate on open
Private Sub UserForm_Initialize() ComboBox1.List = Array("West", "East") End Sub → Fills the dropdown when the form opens
Initialize is the form's setup event.
Worth knowing
- Show vbModeless to let the user work while the form is open.
- Use Me inside the form module to refer to the form.
- Tab order is set in the form's properties.
Where it goes wrong
- Forms do not scale well on high-DPI screens.
- Unload versus Hide: Hide keeps the values, Unload resets them.
Related
Learn the moves here — or let Wauvel run them on your numbers.
Meet your AI CFO →One CFO-grade Excel tip a week
A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.