Cat On A Spreadsheet

Cat On A Spreadsheet

Building a VBA-Powered UserForm That Feels Like a Modern App

UserForms in VBA are one of the most powerful features of Excel. They allow you to create interactive, form-based interfaces where users can enter, view, and manipulate data without touching the raw worksheet. But by default, UserForms often look dated and clunky. With some thoughtful design and a bit of VBA, you can transform them into modern-feeling apps that your users actually enjoy working with. 

 

This post will show you how.

 

Step 1: Setting Up the UserForm

 

In the VBA editor:

  • Insert a new UserForm (Insert > UserForm).

  • Resize it to a clean, app-like window size (e.g., 400×300 pixels).

  • Give it a clear, meaningful name (frmCustomerEntry).

 

Add a few basic controls:

  • TextBoxes for input (Name, Email, Phone).

  • ComboBox for selection (Customer Type).

  • CommandButtons (Save, Cancel).

 

Step 2: Modern Design Principles

 

You can’t completely restyle VBA UserForms, but you can fake modern design by following a few guidelines:

  • Use flat buttons (set SpecialEffect = fmSpecialEffectFlat).

  • Choose a neutral background color (light gray or white).

  • Use consistent font (Calibri, 10pt is clean).

  • Group inputs logically (labels aligned left, text boxes aligned right).

  • Provide feedback (status labels, tooltips).

 

Step 3: Writing Core Logic

Let’s wire up the Save button to validate inputs and write them into a worksheet.

Private Sub btnSave_Click()
Dim ws As Worksheet
Dim nextRow As Long

Set ws = ThisWorkbook.Sheets("Customers")
nextRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1

' Simple validation
If Me.txtName.Value = "" Or Me.txtEmail.Value = "" Then
     MsgBox "Please fill in Name and Email.", vbExclamation
     Exit Sub
End If

' Write values
ws.Cells(nextRow, 1).Value = Me.txtName.Value
ws.Cells(nextRow, 2).Value = Me.txtEmail.Value
ws.Cells(nextRow, 3).Value = Me.txtPhone.Value
ws.Cells(nextRow, 4).Value = Me.cboType.Value

MsgBox "Customer saved successfully!", vbInformation
Me.Hide
End Sub

 

Step 4: App-Like Features

 

Now let’s go beyond basics. Here are a few techniques that make your UserForm feel like a modern app:

 

1. Placeholder Text

 

Give TextBoxes subtle placeholder text that disappears on focus.

Private Sub txtName_Enter()
If Me.txtName.ForeColor = vbGray Then
     Me.txtName.Value = ""
     Me.txtName.ForeColor = vbBlack
End If
End Sub
Private Sub txtName_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Me.txtName.Value = "" Then
     Me.txtName.Value = "Enter full name..."
     Me.txtName.ForeColor = vbGray
End If
End Sub

 

2. Keyboard Shortcuts

 

Enable Enter to trigger Save and Esc to trigger Cancel.

Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
     Case vbKeyReturn: Call btnSave_Click
     Case vbKeyEscape: Me.Hide
End Select
End Sub

 

3. Status Messages

 

Add a Label (lblStatus) at the bottom of the form to show live feedback.

Private Sub txtEmail_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If InStr(Me.txtEmail.Value, "@") = 0 Then
     Me.lblStatus.Caption = "Invalid email address"
Else
     Me.lblStatus.Caption = ""
End If
End Sub

 

Step 5: Launching the UserForm

 

Finally, provide users with an easy way to launch the form, such as a Ribbon button or simple macro:

Sub ShowCustomerForm()
frmCustomerEntry.Show
End Sub

 

Assign this to a Quick Access Toolbar button or Ribbon custom UI to make the form feel like part of Excel itself.

 

Final Thoughts

 

By combining clean design, structured logic, and modern app-like touches, you can elevate a standard VBA UserForm into something that feels polished, professional, and efficient. For internal tools, this can make the difference between users tolerating your workbook and users loving it.

25 August 2025

Full Service Consulting

Reporting

Automation

Cat On A Spreadsheet

Cat On A Spreadsheet