Excel UserForm Scrollbar Control: Setup, Properties, and VBA

VBA & macros · Updated November 21, 2026

In Excel for Microsoft 365 on Windows, a UserForm scrollbar can mean either a standalone ScrollBar control for changing a value, or scrollbars on the form itself for moving through content that does not fit. Add the ScrollBar from the VBA editor’s Toolbox and set its range and change behavior in the Properties window; to scroll the form’s contents, configure the form’s ScrollBars and scroll-area dimensions instead.

Two different kinds of UserForm scrolling

The first step is choosing what should move. A standalone ScrollBar is a control the user drags or clicks to select a numeric value. It is useful for choosing a quantity, setting a percentage, navigating a short list, or changing another control’s value. It does not automatically move the other controls on the form.

A UserForm’s own scrollbars, by contrast, let the user move the visible window over a larger layout of controls. The form’s controls stay in place relative to the form’s full scrollable area; changing the scroll position reveals different portions of that area. A Frame can also have its own scrolling region, which is useful when only one group of controls should move.

  • Use a ScrollBar control when the user needs to select or adjust a value.
  • Use UserForm scrollbars when the form’s contents extend beyond its visible dimensions.
  • Use a Frame with scrollbars when a contained section should scroll independently from the rest of the form.

These are separate features, even though all use the word “scroll.” Adding a ScrollBar control will not make an oversized form scroll automatically.

How to add a ScrollBar control

These steps apply to desktop Excel for Microsoft 365 on Windows. Save the workbook as a macro-enabled workbook, such as an .xlsm file, if it needs to retain VBA code.

  1. Open the workbook and press Alt+F11 to open the Visual Basic Editor.
  2. Choose Insert > UserForm if the project does not already contain a form. If the Toolbox is hidden, choose View > Toolbox.
  3. Select the ScrollBar control in the Toolbox and drag on the UserForm to draw it. Select the control and press F4 to show its Properties window.
  4. Change the control’s (Name) property to a meaningful name, such as sbValue. Set properties such as Min, Max, Value, SmallChange, and LargeChange to suit the task.
  5. Double-click the ScrollBar to create its Change event procedure, then write VBA that uses its Value or updates another control.

In Excel for Windows, Alt+F11 opens the Visual Basic Editor. On Mac, VBA and UserForms are available in desktop Excel, but the editor, shortcuts, and control behavior can differ; use the Mac editor’s menus and verify the form on the Mac version you intend to support. Excel for the web cannot create or run VBA UserForms.

Important ScrollBar properties

ScrollBar properties determine both the range of values and how the control responds. Select the control and inspect its Properties window, or read and set its properties in VBA.

  • Min and Max: The lower and upper bounds for the control’s value. Choose a sensible range for the task; for example, 0 to 100 for a percentage represented in whole numbers.
  • Value: The current numeric selection. The value should fall within the configured range.
  • SmallChange: The amount the value changes for a small step, such as clicking an arrow or using a keyboard action.
  • LargeChange: The amount associated with a larger step, such as clicking the track beside the scroll box. Test the endpoints and larger steps with the range you use, because the control’s behavior depends on its configuration.
  • Orientation: Controls whether the bar is horizontal or vertical when that property is available. You can also size and position it to suit the layout.
  • Name: The identifier used by VBA. A descriptive name makes event code easier to understand than a generic name such as ScrollBar1.

For a one-unit-at-a-time selector, set SmallChange to 1 and use a suitable range. A scrollbar is not a precision input method: a range of thousands of values can be difficult to position accurately with a mouse. For exact entry, consider pairing it with a TextBox or using a ComboBox when the choices are discrete.

A simple VBA example

This example displays the selected number in a TextBox named txtValue. Add a ScrollBar named sbValue and a TextBox named txtValue to the UserForm. Put the following code in that form’s code module. It initializes the control from 0 through 100 and updates the display whenever the value changes.

Private Sub UserForm_Initialize()
    ' Set a whole-number range for the scrollbar.
    Me.sbValue.Min = 0
    Me.sbValue.Max = 100
    Me.sbValue.SmallChange = 1
    Me.sbValue.LargeChange = 1
    Me.sbValue.Value = 0

    UpdateValueDisplay
End Sub

Private Sub sbValue_Change()
    ' Refresh the display after the selection changes.
    UpdateValueDisplay
End Sub

Private Sub UpdateValueDisplay()
    Dim currentValue As Long

    currentValue = Me.sbValue.Value
    Me.txtValue.Value = "Value: " & CStr(currentValue)
End Sub

In VBA code, use the ampersand operator to join text and a value. The HTML representation above encodes that operator as &; when entering the example in the Visual Basic Editor, type a single &, as in "Value: " & CStr(currentValue). If the TextBox should display the value but not accept typing, set its Locked property to True in the Properties window. If a user can also type a value, add validation so typed input cannot leave the scrollbar and display out of sync.

Before running a macro, save a copy of the workbook. VBA actions cannot be undone with Ctrl+Z, and macros should only be enabled in files you trust.

Making the form or a Frame scroll

To scroll the UserForm’s contents, select the form itself in the editor rather than a control. In the Properties window, set its ScrollBars property to a vertical, horizontal, or combined option, then set ScrollHeight and/or ScrollWidth larger than the visible form dimensions. The available choices are represented by the Microsoft Forms constants, including fmScrollBarsVertical, fmScrollBarsHorizontal, and fmScrollBarsBoth. The scrollable dimensions need to exceed the visible dimensions for there to be additional area to reveal.

For example, if the visible form is about 300 points high but the arranged controls extend to about 520 points, a vertical scroll area around 520 points gives the user room to reach the lower controls. Arrange controls within that larger area; setting a large ScrollHeight does not move controls or create new ones. Set ScrollTop to control the initial vertical position when appropriate.

A Frame has related scrolling properties, including ScrollBars, ScrollHeight, ScrollWidth, ScrollTop, and ScrollLeft. Put the controls that belong together inside the Frame, enlarge its scroll area beyond its visible interior, and enable the relevant bar. This is often clearer than making an entire form scroll when its title, instructions, or action buttons should remain visible.

Choosing a useful design

Match the control to the kind of choice rather than adding a scrollbar just because it is available. A continuous-looking setting with a small, bounded range can suit a ScrollBar; a long list of named options is usually easier to understand in a ComboBox or ListBox. For a form containing many fields, a scrollable Frame or a redesign that divides the form into sections may be easier to use than a very tall scrolling page.

  • For a percentage: Use a range such as 0–100 and show the selected number clearly. Explain whether 25 means 25 percent or 0.25.
  • For a record index: Map the scrollbar value to a record number, and display which record is selected. Decide what should happen when the data has no records.
  • For a short set of fixed choices: Prefer a list control if users need to see the available labels before selecting.
  • For many form fields: Consider a scrollable Frame, tabs, or separate forms so users can understand where they are and still reach important buttons.

When linking a ScrollBar to another control, decide which control is authoritative. If a TextBox can be edited, validate its input and update the ScrollBar only after confirming the value is within range. Otherwise, keep the TextBox read-only or locked and let the scrollbar drive the display. This avoids confusing mismatches between a typed number and the bar’s position.

Common problems and fixes

  • The bar moves but nothing else changes: A standalone ScrollBar only changes its own Value. Add code to its Change event to update a label, TextBox, worksheet value, or other control.
  • The wrong control is scrolling: Check whether you added a ScrollBar control or enabled the UserForm’s or Frame’s ScrollBars property. They solve different problems.
  • There is no scroll range: For a form or Frame, check that ScrollHeight or ScrollWidth exceeds the visible dimensions and that the matching scroll direction is enabled.
  • The value stops before the expected endpoint: Review Min, Max, LargeChange, and the control’s current Value. Test the actual range in the form, especially when using large steps or a long range.
  • The form opens at an unexpected position: Check ScrollTop and ScrollLeft, along with any initialization code that changes them.
  • The VBA event does not run: Confirm that the event procedure is in the correct UserForm module and its name matches the control’s current Name property. Renaming a control after writing code can leave a procedure with an old event name.

For debugging, temporarily display the control’s Value in a label or use the VBA editor’s debugging tools. This helps distinguish a control configuration problem from an event procedure that does not update the intended target.

Compatibility and safety considerations

VBA UserForms are desktop Excel features, not interactive forms for Excel for the web. A workbook may open in the web app, but its VBA UserForm cannot run there. If recipients use multiple desktop platforms, verify the form and its controls on each platform rather than assuming every ActiveX or Microsoft Forms control behaves identically.

Macros also have security implications. A workbook containing a UserForm may require macros to be enabled, depending on its source and the organization’s security settings. Do not enable macros in an unexpected workbook just to view a form. For distribution, explain the required desktop Excel environment and provide a non-macro route for users who cannot run VBA, if the task needs one.

Frequently Asked Questions

How do I add a scrollbar to an Excel VBA UserForm?
Open the Visual Basic Editor, insert or select a UserForm, show the Toolbox, and draw a ScrollBar control on the form. Set its Min, Max, and change properties in the Properties window, then use its Change event if it needs to update another control.

How do I make the whole UserForm scroll?
Select the UserForm, enable its ScrollBars property in the Properties window, and set ScrollHeight or ScrollWidth beyond the visible form size. Choose the direction that matches the content and arrange the controls inside the expanded scroll area.

What is the difference between a ScrollBar and a scrollable UserForm?
A ScrollBar is an individual input control whose Value changes. A scrollable UserForm moves the visible view over a larger area of the form. Adding one does not automatically create the other.

Can a UserForm scrollbar update a worksheet cell?
Yes. Its Change event can write the control’s Value to a worksheet cell or use that value to select or calculate something. The code should identify the intended workbook and worksheet explicitly, particularly if more than one workbook may be open.

Do VBA UserForm scrollbars work in Excel for the web?
No. Excel for the web does not run VBA UserForms. Use desktop Excel for a VBA-based form, or redesign the interaction with worksheet controls or another supported tool if users need browser access.

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.