VBA Resize UserForm: Set Size and Enable Resizing

VBA & macros · Updated November 18, 2026

To resize an Excel VBA UserForm, set its Width and Height properties in the form’s Properties window or in the form’s Initialize event; these measurements are in points. To let users drag the form’s edges, set BorderStyle to fmBorderStyleSizable, then use the UserForm_Resize event to adjust the controls inside it.

What resizing a UserForm involves

There are two different tasks people mean by “resize a UserForm.” One is choosing the form’s starting dimensions, which determines how large it appears when opened. The other is allowing the person using the workbook to change the form’s dimensions while it is open. A form can have a fixed startup size, a user-adjustable size, or both.

Changing the form’s dimensions does not automatically rearrange its controls. Text boxes, labels, buttons, and other controls keep their existing positions and sizes unless your code changes them. A larger form can therefore have more empty space around the original controls, while a smaller one can leave controls crowded or outside the visible area.

UserForm dimensions are expressed in points, not pixels. A point is 1/72 of an inch, so a width of 500 points is about 6.94 inches. The apparent size on screen can still vary with display scaling, resolution, and Office’s rendering, so treat the number as a layout measurement rather than a guaranteed pixel width.

Set a fixed size in the Properties window

To set the starting size without writing code, open the Visual Basic Editor in Excel for Windows with Alt+F11, select the UserForm in Project Explorer, and open the Properties window with F4. Select the form itself—not a control—and enter values in its Width and Height properties. You can also adjust these properties while viewing the form in the designer.

Design-time sizing is useful when the layout is stable and every user should see the same initial dimensions. If the form needs to open at a size determined by the workbook or by a particular workflow, set the properties in UserForm_Initialize. The Initialize event runs as the form is loaded, before it is shown.

For example, this sets a predictable initial size:

Private Sub UserForm_Initialize()
    ' Set the starting dimensions in points.
    Me.Width = 500
    Me.Height = 350
End Sub

Change the numbers to suit the content. Leave room for the caption bar, borders, and any controls near the edges. If you set dimensions in code and also set them in the designer, the code assignments determine the dimensions when that initialization procedure runs.

Let the user resize the form

For edge-drag resizing, the important property is BorderStyle. Select the UserForm in the designer and set BorderStyle to 1 - fmBorderStyleSingle for a fixed border, or 2 - fmBorderStyleSizable for a border that can be resized. The exact labels shown in the Properties window can vary slightly with the Forms library, but the value named fmBorderStyleSizable is the resizable choice. A borderless form cannot be resized by dragging a normal window border.

You can also set that property in code, provided the Microsoft Forms constants are available to the project:

Private Sub UserForm_Initialize()
    ' Allow the user to resize the window.
    Me.BorderStyle = fmBorderStyleSizable
    Me.Width = 500
    Me.Height = 350
End Sub

Making the border sizable changes the form window, not the layout rules for its contents. Decide what should happen to each important control when the form grows or shrinks. For example, a notes box might become wider and taller, while a Close button might stay the same size and move to the lower-right corner.

Use the Resize event to adjust controls

Put layout adjustments in the form’s Resize event. In the Visual Basic Editor, select the UserForm, choose UserForm in the left procedure list, then choose Resize in the right list. Excel creates a UserForm_Resize procedure. The following example assumes the form contains a text box named txtNotes and a button named cmdClose:

Private mReady As Boolean

Private Sub UserForm_Initialize()
    ' Set the initial size and enable edge resizing.
    Me.BorderStyle = fmBorderStyleSizable
    Me.Width = 500
    Me.Height = 350
    mReady = True
End Sub

Private Sub UserForm_Resize()
    ' Do not reposition controls before initialization is complete.
    If Not mReady Then Exit Sub

    ' Keep a margin around the notes box as the form grows.
    If Me.InsideWidth > txtNotes.Left + 24 Then
        txtNotes.Width = Me.InsideWidth - txtNotes.Left - 12
    End If

    ' Keep the Close button near the bottom-right corner.
    If Me.InsideHeight > cmdClose.Height + 24 Then
        cmdClose.Left = Me.InsideWidth - cmdClose.Width - 12
        cmdClose.Top = Me.InsideHeight - cmdClose.Height - 12
    End If
End Sub

InsideWidth and InsideHeight describe the usable interior area, while a control’s Left, Top, Width, and Height describe its position and size within that area. The margins in this example are points. Replace the sample control names with the names shown in the Properties window for your own form.

The checks prevent the code from assigning an unusably small width or height when the window is reduced. They are only a basic safeguard: choose minimum dimensions that make sense for your actual controls. Also avoid changing the form’s own Width or Height inside its Resize event unless you deliberately manage the resulting additional resize notifications.

Choose a layout strategy

Small forms often need only a few anchored controls. Keep fixed-size buttons at the bottom, move them as the form changes, and let the main text area take the remaining space. For more complex forms, decide on a consistent layout plan before adding resize code. Controls that should expand together can be updated from the same event; controls that should remain fixed can keep their dimensions.

A proportional layout is another option. You can record each control’s original dimensions and multiply them by the ratio between the current form size and its original size. That approach can work for a dashboard-like form, but it can make text, buttons, and spacing awkward at extreme sizes. It can also be more complicated when controls sit inside frames or multipage controls, because their positions are relative to their immediate container.

For most data-entry forms, a practical design is to resize only the main content area and reposition a small number of buttons. This is easier to maintain than scaling every control. Test with long labels, large amounts of text, and the smallest window size you intend to support; a layout that works with sample data may fail when real content is wider.

Resizing is not the same as scrolling

If the form contains more content than fits comfortably, making the window resizable may not be the best answer. A UserForm can use scroll bars and scrollable dimensions so that users can move through a larger content area inside a smaller window. This is useful for forms with many fields, especially when screen space is limited.

Scrolling and resizing solve different problems. Resizing changes the window’s available area; scrolling lets the user reach content that does not fit in that area. You can combine them, but test the interaction carefully. For example, a large scrollable frame inside a resizable form needs appropriate dimensions and positions as the outer form changes.

Another option is to split a long workflow across multiple pages or separate forms. This can be easier to use than shrinking controls to fit everything at once. If the content is short and fixed, keep the form fixed-size instead of adding resizing behavior that provides no real benefit.

Common problems and how to fix them

  • The form opens at the expected size but controls do not move. That is normal: controls do not automatically anchor or stretch. Add positioning code to UserForm_Resize, or keep the form fixed-size.
  • The border has no resize grip or will not drag. Check that the selected object is the UserForm and that its BorderStyle is fmBorderStyleSizable, not fmBorderStyleSingle or fmBorderStyleNone.
  • A control disappears after shrinking the form. Add minimum-size checks, reposition the control, or use scrolling. The form’s window can become smaller than the layout was designed to support.
  • Controls jump during startup. A resize notification can occur while the form is being initialized. Use a Boolean flag, as in the example, so layout code runs only after the initial dimensions and controls are ready.
  • Code refers to the wrong control. Check the control’s (Name) property, not its displayed caption. A button caption such as “Close” does not mean its code name is Close.

Display scaling can also affect how a form appears across computers. Avoid assuming that a point value will translate to identical on-screen pixels for every user. Test the form at the display settings and Office versions your workbook needs to support, and leave a little space around controls rather than positioning them exactly against the edges.

Windows, Mac, and workbook considerations

The steps and code above describe Excel for Microsoft 365 on Windows. Excel for Mac includes VBA and UserForms, but the Visual Basic Editor shortcuts and some interface details differ; on many Mac keyboards, Option+F11 opens the editor, sometimes with the Fn key as well. Microsoft Forms controls and window behavior may not be identical across platforms, so check a form on the Mac if the workbook is intended for both operating systems.

A UserForm is part of the workbook’s VBA project, so the workbook must be saved in a macro-enabled format such as .xlsm if it contains macros. Users also need to allow macros according to their organization’s security settings. Resizing code does not require an external library, but solutions that use Windows API calls to enforce minimum or maximum window dimensions are platform-specific and should not be assumed to work on Mac.

Before running or changing a macro, save a copy of the workbook. VBA macros cannot be undone with Ctrl+Z, so a backup is the simplest way to protect the original file while you adjust layout code.

Frequently Asked Questions

How do I change a UserForm’s size in VBA?

Set Me.Width and Me.Height in the form’s Initialize event, or edit those properties in the UserForm’s Properties window. The values are in points.

How do I make an Excel UserForm resizable?

Set the form’s BorderStyle property to fmBorderStyleSizable. Add code to UserForm_Resize if controls should move or grow along with the form.

Does changing the UserForm size resize its controls automatically?

No. Controls retain their original sizes and positions unless VBA changes their properties. Use the Resize event to implement the layout behavior you want.

Can I set a minimum or maximum UserForm size?

UserForms do not provide a straightforward built-in minimum-width or maximum-width property. You can check dimensions in resize code, but enforcing strict window limits may require platform-specific Windows API code, which is not portable to Mac.

Why is my UserForm still too small after changing Width and Height?

Confirm that you changed the UserForm’s properties rather than a control’s, and check whether code in Initialize or another procedure assigns different values later. Also remember that point measurements can look different under different display scaling settings.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.