listbox with multiple selections

D

DaveL

I have built a listbox that allows multiple selections and I have put those
slelections into an array. At this point I want to unload the userform and
use that array in a macro outside of the userform. However, I can't find a
way to access the array I created in the userform. It appears I have to
write the selections to a worksheet, then use a macro to read and write them
into an array and then delete the worksheet in order to move on and do what I
want with an array of selected items. Is that right or am I missing
something?
 
R

Robert McCurdy

Hi Dave,

Create a button on the Userform.
The code should look something like this:

Cells(2,1).Resize(ubound(YourArray,1),ubound(YourArray,2)) = YourArray

YourArray should get placed from cell A2 with the above example.
You will - of course - require a bit of error handling here. :)


Regards
Robert McCurdy
 
D

DaveL

rouUK,

OK, that made me look foolish. I don't know why I had it in my head that
a variable scoped as public wouldn't work with a userform. This makes it
clean and easy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top