VBA & Macro Problems

How to Enter Data in Excel While a VBA UserForm is Open

Bushra ParveenBushra Parveen Nov 2, 2026 870 views

Question details

The user needs to keep a custom VBA UserForm visible and active while continuing to select cells and enter data directly into the underlying Excel worksheet.

How to Enter Data in an Excel Sheet While a VBA UserForm Is Open
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running an Excel VBA macro that displays a custom UserForm meant to act as a floating toolkit or reference guide, which requires simultaneous access to the spreadsheet.
Observed behavior
By default, the VBA UserForm opens as a modal window, which completely blocks any user interaction with the Excel worksheet until the form is closed.
Before you start

Ensure you have the Developer tab enabled in your spreadsheet program and that your workbook is saved in a macro-enabled format (.xlsm) to prevent losing your VBA code.

Solution 1Recommended

Display the UserForm as Modeless Using VBA Code

Changing the UserForm's display mode to modeless allows you to interact with the worksheet while the form remains visible and active.

In VBA, forms and message boxes are modal by default, meaning they halt all other activity in the application until they are dismissed. By explicitly calling the form with the vbModeless constant, you instruct Excel to detach the form's focus from the main application window.

1
Open the VBA Editor

Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Locate the macro triggering the form

In the Project Explorer pane, find the module or specific macro script where your UserForm is currently being called (e.g., UserForm1.Show).

3
Update the code to modeless

Modify the code line to include the vbModeless parameter. For example, change it to: UserFormName.Show vbModeless (replace 'UserFormName' with the actual name of your form).

4
Run your macro

Save your code and run the macro. The UserForm will now float over your worksheet, allowing you to freely click cells and type data.

Display the UserForm as Modeless Using VBA Code
Pro Tip: Modeless UserForms are excellent for building custom floating toolbars, live data entry assistants, or real-time progress monitors.
Advanced Macro Support

Execute VBA Macros Seamlessly in WPS Office

WPS Spreadsheet provides powerful compatibility with standard Excel VBA macros. You can easily create, edit, and run modeless UserForms without altering your existing VBA code.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your macro-enabled workbook (.xlsm).
  2. 2. Access the Developer Tools: Navigate to the Developer tab on the ribbon and click on 'VBA Editor'.
  3. 3. Apply modeless code: Find your macro and append 'vbModeless' to your UserForm.Show command exactly as you would in standard Excel VBA.
Fully compatible with Microsoft Excel .xlsm and .xlsb formatsNative support for VBA modules, UserForms, and scriptsFamiliar developer interface and easy macro troubleshootingLightweight, fast, and free to download
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between modal and modeless UserForms?

A modal UserForm (the default) requires the user to interact with it and close it before they can return to the main application. A modeless UserForm allows the user to switch focus back and forth between the form and the background worksheet, enabling simultaneous data entry.

Why does a standard MsgBox block my Excel sheet?

A standard MsgBox in VBA is strictly modal by design. Its purpose is to force the user to read an alert or make a choice (like Yes/No) before the macro code can proceed, which is why it blocks all other Excel interactions.

Will vbModeless work on older versions of Excel?

Yes, vbModeless is a standard VBA constant that has been supported in Microsoft Excel since Excel 2000. It is fully backward compatible with almost all functional versions of Excel currently in use.

Why is my macro continuing to run in the background after opening a modeless UserForm?

When a form is opened as modal, the macro execution pauses at the UserForm.Show line until the form is closed. When opened as modeless, the VBA compiler immediately moves to the next line of code after showing the form. You may need to adjust your code logic if it relies on the form being closed to proceed.