Short List

A

Antonio Atala

Is there a way to make this userForm to sort my information ?
Thanks in Advance

Antonyo
Regards


Private Sub CommandButton1_Click()
Dim iListCount As Integer, iColCount As Integer
Dim iRow As Integer
Dim rStartCell As Range
'Set a range variable to the first cell to recieve our data
'Using "End(xlUp).Offset(1, 0)" _
will give us the cell below the last entry
Set rStartCell = Sheet3.Range("F65536").End(xlUp).Offset(1, 0)
'Loop as many times (less one) as there are entries in our list.
'We must start from zero to use this in the Selected Property.
For iListCount = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(iListCount) = True Then 'User has selected
ListBox1.Selected(iListCount) = False
iRow = iRow + 1
'Now loop as many times as there are columns in MyRange
For iColCount = 0 To Range("MyRange").Columns.Count - 1
'place the selected data into the table, starting from _
range Ax and moving across as many columns as there are _
in the range MyRange.
rStartCell.Cells(iRow, iColCount + 1).Value = _
ListBox1.List(iListCount, iColCount)
Next iColCount
End If
Next iListCount
Set rStartCell = Nothing
Unload Me
End Sub
 

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