BrianExcel
Well-known Member
- Joined
- Apr 21, 2010
- Messages
- 975
I have two listboxes on a form. The first box is populated with many records. I want someone to be able to select as many records as they need, and press a button which will transfer those selected records into a second listbox, confirming they have selected.
Can anyone help with some basic code for this? Right now I am using the following code, but it only copies the very last record selected, instead of all of them...
Can anyone help with some basic code for this? Right now I am using the following code, but it only copies the very last record selected, instead of all of them...
Code:
Private Sub CommandButton2_Click()
Dim bvalue As Boolean
Dim sSum As String
Dim x As Integer
Dim rTotal As Range
For x = 0 To UserForm1.lbxStock.ListCount - 1
If UserForm1.lbxStock.Selected(x) Then
sNode = UserForm1.lbxStock.List(x)
End If
Next x
With Sheets("Lists (Do NOT Delete)")
.Range("G2").Value = sNode
End With
End Sub