How to Enter Data in Excel While a VBA UserForm is Open
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.

- 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.
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.
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.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane, find the module or specific macro script where your UserForm is currently being called (e.g., UserForm1.Show).
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).
Save your code and run the macro. The UserForm will now float over your worksheet, allowing you to freely click cells and type data.

Change the ShowModal Property in the Properties Window
You can permanently set a UserForm to be modeless without writing the vbModeless parameter in your code every time it is called.
Use an InputBox for Simple Data Entry
If your goal is just to capture a single string or number from the user rather than displaying a complex custom form, an InputBox is a simpler alternative.
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. Open your file in WPS Spreadsheet: Launch WPS Office and open your macro-enabled workbook (.xlsm).
- 2. Access the Developer Tools: Navigate to the Developer tab on the ribbon and click on 'VBA Editor'.
- 3. Apply modeless code: Find your macro and append 'vbModeless' to your UserForm.Show command exactly as you would in standard Excel VBA.

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.




