VBA & Macro Problems

How to Pass More Than 60 Values to a VBA Procedure in WPS Office

Tauseeq MagsiTauseeq Magsi Nov 13, 2026 869 views

Question details

The user needs to pass more than 60 values to a VBA procedure without creating a long list of individual parameters.

How to Pass More Than 60 Values to a VBA Procedure in WPS Office
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
Writing or maintaining a VBA macro in WPS Office and reducing a procedure signature with 60 or more arguments.
Observed behavior
The procedure needs to accept many values in a maintainable way, such as an array, range, object, or custom data structure.
Before you start

Open the workbook in WPS Spreadsheets, press Alt+F11 to open the VBA editor, and identify the Sub or Function that currently has the long parameter list. If the data is already in a worksheet, note the range address you want to pass, such as A1:CB2.

Solution 1Recommended

Pass a Worksheet Range or Variant Array to the Procedure

Use this when the 60+ values are already stored in a worksheet range or can be assembled into a single array.

VBA procedures can accept a Variant parameter and receive an entire range’s Value2 array. This removes the need to declare 60 individual ByVal arguments and makes the call much shorter.

Inside the procedure, the data is a 1-based two-dimensional array, so values are addressed by row and column index.

1
Open the VBA editor

In WPS Spreadsheets, press Alt+F11 or click the Developer tab and select View Code to open the VBA editor.

2
Change the procedure signature

Locate the procedure and replace the long parameter list with Sub ProcessData(ByVal data As Variant).

3
Pass a range array from the calling code

In the calling macro, use Call ProcessData(ThisWorkbook.Sheets("Data").Range("A1:CB2").Value2) so the entire range is passed as one argument.

4
Access values by index inside the procedure

Inside ProcessData, read or assign values using indexes such as data(1, 1) for the first row and first column.

Pass a Worksheet Range or Variant Array to the Procedure
Recommended for worksheet data: You can pass any sized range with one argument; just update the range address if the number of columns grows.
WPS Office VBA Macro

Pass Many Values to a VBA Procedure with WPS Office Spreadsheets

WPS Office Spreadsheets supports VBA macros, so you can replace 60+ individual arguments with a single Range or Variant array, custom class, or Dictionary object. This keeps macros maintainable and compatible with Excel VBA projects.

  1. 1. Open the VBA editor in WPS Spreadsheets: Click the Developer tab and select View Code, or press Alt+F11, to open the VBA editor.
  2. 2. Create or open the macro: In the Project Explorer, double-click the module that contains the procedure you want to update.
  3. 3. Replace the long parameter list: Change the Sub or Function signature to Sub ProcessData(ByVal data As Variant) so it accepts one array or object instead of many arguments.
  4. 4. Pass the consolidated data: In the calling macro, pass ThisWorkbook.Sheets("Data").Range("A1:CB2").Value2 or an object variable to the procedure.
  5. 5. Run and test the macro: Click Run > Run Sub/UserForm or press F5 to verify that the procedure reads all values correctly.
Edit and run VBA macros directly in WPS Office SpreadsheetsPass a Range or Variant array instead of 60+ parametersOpen and save Excel macro-enabled .xlsm and .xlsx filesFree, lightweight, and familiar interface for Excel usersUse custom classes or Dictionary objects for complex data
microsoft office alternative - wps office

Frequently Asked Questions

Can WPS Office run Excel VBA macros that use Range.Value2 arrays?

Yes. WPS Spreadsheets supports VBA macros. Open the VBA editor with Alt+F11, change the procedure to accept a Variant, and pass Range("A1:CB2").Value2 from the calling code.

How do I pass more than 60 values from a worksheet into a VBA Sub without listing each argument?

Declare the Sub with one Variant parameter, for example Sub ProcessData(ByVal data As Variant). Then call it with the range’s Value2 property. The data becomes a two-dimensional array addressed as data(row, column).

What is the difference between passing a Range object and passing a Variant array to a VBA procedure?

A Range object keeps the worksheet reference and methods, while a Variant array created from Range.Value2 is a snapshot of the values. Use the Variant array when you only need the data and want stable values even if the sheet changes.

Can I pass a custom class or Dictionary object to a VBA procedure in WPS Spreadsheets?

Yes. Insert a Class Module from the VBA editor Insert menu and define public properties, or add a reference to Microsoft Scripting Runtime and pass a Dictionary object for named lookups.

Does WPS Spreadsheets support macro-enabled Excel files?

Yes. WPS Spreadsheets can open and save .xlsm macro-enabled workbooks, so you can maintain VBA projects that originally come from Microsoft Excel.