• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Transferring Multiple Values from a Selection Box

daddy_fat_sax

New Member
VBA newbie with issues. I am having issues transferring multiple values from a selection box, to another worksheet. I would like to be able to allow the user to select up to 25 values in a selection box, and have these values transferred to 25 rows in an another worksheet. Any help would be much appreciated.
 
Hi, daddy_fat_sax!

Have a look at this file:

http://www.megaupload.com/?d=R3X6YMCQ

You have 50 values in column A, a list box multiselect associated to A1:A100, after you select multiple lines and quit the list box, column E is emptied and filled with the selected values.

VBA code:

-----

Option Explicit


Private Sub ListBox1_LostFocus()

' constantes

' declaraciones

Dim I As Integer, J As Integer

' inicio

Range("E:E").ClearContents

' proceso

J = 0

For I = 0 To ListBox1.ListCount - 1

If ListBox1.Selected(I) Then

J = J + 1

Cells(J, 5).Value = ListBox1.List(I)

End If

Next I

' fin

End Sub

-----

Regards!
 
Back
Top