VBA and Excel - Multiple Values from a Listbox into a Named Range

nashat21

Registered User.
Local time
Today, 05:13
Joined
Jul 15, 2002
Messages
18
A friend is trying to paste multiple values selected from a listbox into a named range. Is there any way this can be done?

Any and all help will be greatly appreciated.

Nashat
 
You need to obtain the members of the selected collection one at a time so it would probably be easiest to paste them as they are identified.
Code:
    For Each i In Me.YourControl.ItemsSelected
        'code to insert into sheet cell
    Next i
 
Member or Object not found

That seems to be the error I am getting. Apparently, it does not recognize the ListBox1 as an object in Me or ThisWorkbook or Sheet1.

Can you help?

Nashat
 
The code needs to be within the form for the Me. reference to work since Me refers to the active form. If your code is running in a standard module, you will need to reference the form field by its full name - Forms!YourForm!YourControl - or pass a reference to the control as an argument when you run the sub.

If that doesn't help, you'll need to post your code for people to look at.
 

Users who are viewing this thread

Back
Top Bottom