VBA & Macro Problems

How to Send Excel VBA UserForm Data to a Selected Worksheet

Algirdas JasaitisAlgirdas Jasaitis Nov 4, 2026 872 views

Question details

The user needs to route data submitted through an Excel VBA UserForm to a specific destination worksheet that is dynamically chosen via a ComboBox selection.

How to Send Excel UserForm Data to a Worksheet Selected in a ComboBox
Product
Excel
Device & OS
not provided
Scenario
Developing a dynamic data entry tool using an Excel UserForm where the submitted data needs to be sorted into different worksheets (like Merchant or Medical) based on a dropdown selection.
Observed behavior
A method is required to read the selected value from a ComboBox, use it as a valid worksheet reference, and write the form data to the first blank row of that specific sheet.
Before you start

Ensure that the text values populated in your ComboBox perfectly match the actual names of the destination worksheets in your workbook to avoid 'Subscript out of range' errors.

Solution 1Recommended

Route UserForm Data Using the ComboBox Value as the Worksheet Name

Use the selected ComboBox value to dynamically reference the destination worksheet and append data to the next available blank row.

By dynamically referencing the worksheet using the ComboBox value, you eliminate the need for lengthy If/Else or Select Case statements. The macro determines where the data goes based solely on the user's dropdown choice.

1
Open the Command Button Click Event

In the VBA Editor, double-click the Submit button on your UserForm to open its Click event procedure.

2
Validate the ComboBox Selection

Add a quick validation check (e.g., If combo_intake_type.Value = "" Then MsgBox "Please select a worksheet") to ensure the user has made a selection before proceeding.

3
Reference the Destination Worksheet

Use a With statement to target the selected sheet: Write 'With Worksheets(combo_intake_type.Value)'. Replace 'combo_intake_type' with the actual name of your ComboBox.

4
Find the Next Blank Row and Write Data

Inside the With block, find the first empty row in Column A and pass the data: '.Cells(.Rows.Count, "A").End(xlUp).Offset(1).Value = SourceOfData.Value'.

Route UserForm Data Using the ComboBox Value as the Worksheet Name
Data Transfer Syntax: Alternatively, you can use .End(xlUp)(2).Value instead of Offset(1) to target the next empty row.
Advanced Macros Made Easy

Create and Manage VBA UserForms in WPS Spreadsheet

WPS Spreadsheet provides excellent support for VBA macros and UserForms, allowing you to build dynamic data entry tools and route data efficiently.

  1. 1. Download and Install WPS Office: Get WPS Office from the official website and complete the installation on your device.
  2. 2. Enable the Developer Tab: Open WPS Spreadsheet, go to the settings to enable the Developer tab if it is not already visible.
  3. 3. Open the VBA Editor: Click on 'VBA Editor' under the Developer tab to access, create, or modify your UserForms and macro scripts.
  4. 4. Run Your Macro: Save your file as an .xlsm document and execute your UserForm seamlessly within WPS Spreadsheet.
Full support for VBA (Visual Basic for Applications) and UserFormsSeamless compatibility with Microsoft Excel (.xlsm) formatsLightweight architecture for fast macro executionFree and intuitive interface for seamless transition
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a 'Subscript out of range' error when submitting my UserForm?

This error occurs because the value selected in the ComboBox does not match any existing worksheet name in your workbook. Check for trailing spaces, typos, or ensure the worksheet has not been renamed or deleted.

How do I clear the UserForm data after successfully sending it to a worksheet?

At the end of your submit button's VBA code, add lines to reset the form fields. For example, use 'TextBox1.Value = ""' and 'ComboBox1.ListIndex = -1' before the 'End Sub' statement.

Can I populate related ListBox data based on the worksheet selected in the ComboBox?

Yes. You can use the ComboBox_Change() event to trigger a macro that reads the newly selected worksheet name and dynamically loads specific data ranges from that sheet into your ListBox.