To set an Excel VBA UserForm’s tab order, open the form in the Visual Basic Editor, choose View > Tab Order, and move the controls into the sequence users should follow. The first control has a TabIndex of 0; controls with TabStop set to False are skipped when the user presses Tab.
What tab order means
Tab order is the sequence in which keyboard focus moves through controls when someone presses Tab. Pressing Shift+Tab moves backward through that sequence. Focus indicates which control will receive keyboard input or respond to certain keys; for example, a focused text box is ready for typing. A sensible sequence lets someone complete a form without having to reach for a mouse.
Tab order is separate from the visual layout. A form may have a text box near the top left and another below it, but the sequence is determined by each control’s TabIndex, not by its position on the screen. A form designed by adding controls in one order can therefore behave unexpectedly after controls have been moved or added.
Excel UserForms use the Microsoft Forms controls and properties available in the VBA editor. This is distinct from worksheet navigation: changing the order of worksheet cells with Tab or changing a sheet’s protected-cell selection settings does not alter a UserForm’s control order.
Set the order in the VBE dialog
The Tab Order dialog is usually the clearest way to arrange a form. In Excel for Microsoft 365 on Windows, press Alt+F11 to open the Visual Basic Editor, find the form in Project Explorer, and double-click it to show the designer. Click the form’s background if needed, then choose View > Tab Order. Select a control in the dialog and use the move-up or move-down controls to place it in the desired sequence. Confirm the dialog when finished.
- Decide the intended keyboard sequence before rearranging controls. A data-entry form commonly proceeds from the first field to the next field, then to the main action button.
- In the Tab Order dialog, move controls until the list reflects that sequence. Read the displayed control names carefully; names such as
TextBox1are easy to confuse if the form has many controls. - Close the dialog and save the workbook. The designer stores the revised order with the UserForm.
- Run the form and verify the result by pressing Tab repeatedly, then Shift+Tab to check reverse navigation.
The exact menu availability depends on having a UserForm open in the designer. If the code window is active, return to the form design surface first. The dialog changes keyboard sequence; it does not reposition controls or change their captions.
Understand TabIndex and TabStop
TabIndex is the numeric position assigned to a control in its tab sequence. It is zero-based: the first tab stop has index 0, the next has index 1, and so on. You can inspect a selected control’s properties in the Properties window, commonly shown with F4 in the VBE. The Tab Order dialog is often safer than editing several numeric values manually because changing one index can shift the positions of other controls.
TabStop answers a different question: should the control be visited as the user tabs through the form? A control with TabStop set to False is left out of normal Tab and Shift+Tab navigation. This is useful for a control that should remain clickable but should not interrupt keyboard entry. It does not mean the control is disabled, hidden, or removed from the form.
Not every control is an appropriate tab stop, and some controls do not expose the same keyboard properties. For example, a decorative label is not normally a destination for keyboard focus. Avoid trying to give every visible object a place in the sequence; include controls users need to operate or enter information in. A disabled or hidden control cannot provide a useful step in the user’s current workflow.
Plan a usable sequence
A good order usually follows the way a person reads and completes the form, rather than the order in which controls were created. For a contact form, a reasonable sequence might be name, email address, phone number, comments, then Submit. A Cancel button may come after Submit, or be reachable by mouse, depending on the form’s purpose and conventions. The important point is that the order should be predictable and should not jump unexpectedly across the layout.
- Group related fields together, such as address fields or billing details.
- Keep the sequence consistent with visible labels and the form’s reading flow.
- Include essential buttons in the keyboard route so users can complete or leave the form without a mouse.
- Skip decorative or redundant controls when they should not receive keyboard focus.
- Use clear control names in the VBE, such as
txtEmailorcmdSubmit, so the order is easier to maintain.
Tab order is also a usability and accessibility concern. A person navigating by keyboard should be able to identify where focus is and move through the controls in a logical way. The sequence alone does not make a form fully accessible: meaningful labels, readable instructions, appropriate contrast, and clear focus indication matter too.
Frames, MultiPage controls, and nested controls
Containers add an important detail: tab order is not always one flat list for the entire form. A Frame can contain other controls, and a MultiPage control contains pages with their own controls. The container itself has a position in the parent form’s sequence, while the controls inside it are ordered within that container or page. Arrange both levels deliberately.
For example, a form might have a customer-details frame followed by a notes text box and a Submit button. The frame belongs in the form-level sequence; inside the frame, the name field should precede the email field. If the frame’s internal sequence is wrong, moving the frame earlier or later on the main form will not fix that internal problem. Open the Tab Order dialog while working with the relevant form or container and check the controls at the level you intend to change.
With a MultiPage, only the controls on the active page are available for the user to interact with at that moment. Set a sensible sequence for each page, and also consider how the user reaches the page tabs and returns to other controls. Test each page rather than assuming that a correct order on the first page applies everywhere.
Common tab-order problems and fixes
If Tab skips a control, first check whether its TabStop property is False. Also check whether the control is disabled, hidden, or inside a container or page that is not active. Some control types are not designed to take focus in the same way as text boxes and buttons. If a control can receive focus but appears in the wrong place, reopen the Tab Order dialog and inspect the order in its container.
If the form behaves differently from the designer’s apparent order, remember that visual position does not define keyboard order. Moving a control with the mouse does not necessarily establish the sequence you expect. Likewise, renaming a control changes its identifier, not its position in the tab sequence.
If keyboard navigation seems to stop, test the form while it is running and check whether focus has moved into a control that handles Tab internally. Some controls use keys for their own purposes, and behavior can vary by control and configuration. Also verify that the form is not intercepting keyboard input with custom event code. Test the actual workflow instead of relying only on the TabIndex numbers shown in the Properties window.
Changing TabStop in VBA
You can change a control’s TabStop property in code when the choice depends on the form’s state. For example, this UserForm event keeps a Cancel button out of the regular tab sequence. Add the procedure to the UserForm’s code module and use the actual name of your button:
Private Sub UserForm_Initialize()
' Let users click Cancel, but skip it during Tab navigation.
Me.cmdCancel.TabStop = False
End Sub
This example changes whether the button is visited; it does not create a new ordering or set the other controls’ indexes. If the tab sequence needs to change as well, configure it in the designer and test the runtime behavior. Save a copy of the workbook before running a macro: VBA changes cannot be undone with Ctrl+Z.
Testing and platform notes
In the VBE, run the UserForm with F5 while the form or its code is active, or use the macro or worksheet control that normally opens it. Press Tab from the first intended field and watch both the focus highlight and the control receiving input. Then press Shift+Tab several times. Test buttons, drop-downs, frames, and every MultiPage page that matters to the task.
The steps above target Excel for Microsoft 365 on Windows. The Visual Basic Editor and UserForms are desktop VBA features; Excel for the web cannot run VBA UserForms. Excel for Mac has a Visual Basic Editor and supports VBA, but its menus and keyboard shortcuts can differ from Windows, and available controls or behavior may vary. On a Mac, use the editor’s menu bar to locate the Tab Order command rather than assuming Windows shortcuts or menu placement are identical.
Frequently Asked Questions
What is the shortcut for changing UserForm tab order?
There is no need to rely on a special shortcut: open the UserForm designer and choose View > Tab Order in the VBE. On Windows, Alt+F11 opens the editor from Excel; that shortcut opens the editor, not the Tab Order dialog itself.
Does TabIndex start at 0 or 1?
It starts at 0. The first control in the tab sequence has a TabIndex of 0, the second has 1, and subsequent controls continue from there.
How do I make a control skip when I press Tab?
If the control supports the property, set its TabStop property to False in the Properties window or in VBA. The control can remain visible and usable by other means; this setting only removes it from normal tab navigation.
Does moving a control change its tab order?
Do not assume so. A control’s position on the form and its TabIndex are separate. Use the Tab Order dialog to set the keyboard sequence explicitly, then test it.
Why does tab order inside a Frame seem separate?
A Frame is a container. Its place in the main form’s sequence is separate from the order of controls inside it, so check and arrange the internal sequence as well as the form-level sequence.
Related
- Excel Shortcut Keys for the Next Sheet in a Workbook
- Excel Named Range Data Validation List: Setup and Fixes
- Excel Named Range in a Drop-Down List: How to Set It Up
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Microsoft Excel VBA: What It Is and How to Use ItMicrosoft Excel VBA is the programming language built into the desktop versions of Excel that lets you automate…
- Excel VBA Error Handler: How to Catch and Fix ErrorsAn Excel VBA error handler is code that tells a macro what to do when a runtime error…
- Excel VBA Progress Bar: How to Build a Responsive OneAn Excel VBA progress bar shows how much of a long-running macro has finished. For a visual bar,…
- Sort Columns in Excel with VBAYes. In Excel VBA, use the Sort object to sort entire rows by values in a chosen column,…
- VBA Delete Row and Shift Up: Excel Macro ExamplesTo delete an entire worksheet row with VBA and move the rows below it up, use Rows(rowNumber).Delete, such…
- Excel VBA: Save a Worksheet as a New File SafelyTo save one Excel worksheet as a separate file with VBA, copy it to a new workbook with…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.