Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel VBA UserForm Modern Design: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You can give an Excel VBA UserForm a modern look without any add-ins: set the form's BackColor to a light neutral, remove the default border style, place flat labels and text boxes on a colored panel, add hover effects with a few lines of code, and use Segoe UI at 10–11pt throughout. The result looks closer to a current Windows dialog than the grey 1990s box Excel gives you by default, and it still runs on any machine with Excel and the VBA editor.

Everything below is done inside the VBA editor (Alt+F11) and the Properties window (F4). Menu and dialog labels can differ slightly by Excel version and Windows display language, so if a name looks different, look for the closest match.

What You'll Need

  • Excel on Windows with the VBA editor available (Alt+F11). On Excel for Mac the VBA editor exists but UserForm support and some controls behave differently, so the steps here are written for Windows.
  • Macro security set to allow macros in the workbook (File > Options > Trust Center > Trust Center Settings > Macro Settings).
  • A blank workbook saved as .xlsm so your code and form are kept.
  • No third-party controls or downloads. Everything uses the built-in Toolbox controls.

Step-by-Step

  1. Create the form. Press Alt+F11 to open the VBA editor, then use Insert > UserForm. A blank grey form and the Toolbox appear. If the Toolbox is missing, use View > Toolbox.
  2. Set the base look in Properties. Click the form, press F4, and change: BackColor to a light neutral (for example &H00F5F5F5, which is near-white), BorderStyle to 0 – fmBorderStyleNone for a flat edge, Caption to your title, and Font to Segoe UI, 10 or 11pt. Keep the form's default size modest; a form wider than about 400 points feels cramped on smaller laptops.
  3. Add a header band. Drag a Label onto the top of the form, set its BackColor to a dark accent (for example &H00423B32 for a charcoal), ForeColor to white, Caption to the form name, Font to Segoe UI 14pt bold, and BorderStyle to 0. Size it to span the full width and sit flush against the top edge.
  4. Lay out a content panel. Place a Frame or a second Label below the header as a white card. Put your TextBoxes and ComboBoxes on top of it. Set each input's BorderStyle to 1 – fmBorderStyleSingle, BackColor to white, and Font to Segoe UI 10pt. Align them with Format > Align and Format > Make Same Size rather than dragging by eye.
  5. Style the buttons. Add two CommandButtons (for example Save and Cancel). Set Font to Segoe UI 10pt, BackColor to your accent for the primary button and a light grey for the secondary, ForeColor to white on the dark button, and Caption to short verbs. VBA CommandButtons on Windows respect BackColor; on some themes the button still draws a border, which is normal.
  6. Add hover feedback. In the form's code module, add MouseMove events for each button. For example, for a button named cmdSave: Private Sub cmdSave_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) followed by cmdSave.BackColor = &H006B5E48. Add a MouseMove on the form itself that resets the button color, so the highlight clears when the pointer leaves. Keep the two colors close in tone so the change reads as a subtle lift, not a flash.
  7. Set a sensible tab order. Use View > Tab Order on the form and move controls so Tab moves top-to-bottom through the inputs, then to the primary button. This is the single biggest usability fix and costs nothing.
  8. Add validation and a close action. In the Save button's Click event, check that required TextBoxes are not empty and show a MsgBox if they are. In the Cancel button, use Unload Me. In the form's QueryClose event, confirm before closing if the user has typed something, so work is not lost.
  9. Show the form from a module. In a standard module, write Sub ShowForm() followed by UserForm1.Show. Run it with F5 or attach it to a button on the sheet. Test at 100% and 125% Windows display scaling, because a layout that fits at 100% can clip at higher scaling.
  10. Polish the small details. Turn off the form's default minimize and maximize boxes if they are not needed, set the form's Caption to something short, and remove any control you do not use. A modern look is mostly restraint: one accent color, one neutral background, consistent 10–11pt text.

Common Mistakes

  • Mixing fonts and sizes. Pick Segoe UI and stick to two sizes (a heading and body text).
  • Using bright, saturated colors for large areas. Use a neutral background and one accent.
  • Leaving the default border style, which adds a heavy 3D frame that undoes the flat look.
  • Forgetting tab order, so the cursor jumps around the form unpredictably.
  • Hard-coding pixel positions that break at different Windows scaling settings.
  • Putting validation only in the Save button and not in the form's QueryClose, so users can close with invalid data.

Tips

  • Use the same accent color in the header and the primary button so the form reads as one design.
  • Keep labels above inputs rather than beside them; it is easier to align and reads better at small sizes.
  • Set the form's Zoom property if you need to preview a larger layout on a small screen.
  • Name controls meaningfully (txtName, cmdSave) before writing code; renaming later means updating every reference.
  • Group related inputs with a thin horizontal Label as a divider instead of a heavy Frame border.

Troubleshooting

  • The form still looks grey and boxy. Check that BorderStyle is set to 0 and that BackColor was changed on the form, not just on a control.
  • Button colors do not change. Confirm the MouseMove event is on the button itself and that the form also has a MouseMove that resets the color.
  • Controls overlap or clip at other screen sizes. Re-check alignment with Format > Align, and test at 125% and 150% Windows scaling.
  • The macro will not run. Check Trust Center macro settings and that the workbook is saved as .xlsm.
  • The form opens behind Excel. Make sure the form is shown from a normal module with UserForm1.Show, and close any modal message boxes left open.

Frequently Asked Questions

Can I make a UserForm look modern without third-party controls?

Yes. Flat border styles, a neutral background, one accent color, Segoe UI text and MouseMove hover effects cover most of the visual difference.

Why do my button colors not show on some machines?

Windows themes and display settings can affect how VBA draws CommandButtons. The color is applied, but the button chrome may still show a border. Test on the machines that will run the workbook.

Do these steps work on Excel for Mac?

UserForms exist on Mac but control behavior and some properties differ, and hover events are less reliable. Treat the layout as Windows-first and test separately on Mac.

How do I stop users closing the form with unsaved data?

Use the form's QueryClose event to check whether inputs have changed and show a confirmation MsgBox before allowing the close.

Is there a way to reuse the design across forms?

Not directly. You can copy controls between forms in the VBA editor, or export the form and import it as a starting template for the next one.

Will a styled form slow down my workbook?

No. Colors, fonts and a few MouseMove events add negligible overhead compared with reading and writing worksheet data.