Passing arguments from Excel to a UserForm.

LaShark

New Member
Joined
Mar 17, 2002
Messages
9
Can anyone provide an example passing an array of values from an excel macro to a UserForm. Can't seem to find anything in the books or help box.

Thanks in advance
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You need to use ByRef to pass arrays. For example, if I've got a function in a standard module that needs a string array as an argument I would declare the function like this:

<pre>
Private Function MyArrayFunction(ByRef sArray() as String)
'...
End Function</pre>

If this Function is on a UserForm or Class Module and you wanted to call them from outside of that module you woud have to declare the function like this:

<pre>
Public Function MyArrayFunction(ByRef sArray() as String)
'...
End Function</pre>

HTH
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,214
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top