gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,342
- Office Version
- 365
- Platform
- Windows
I have code that allows the users to select multiple rows in a list box and it puts those selections on a sheet starting in B11
It is taking the value from column 10 of the Listbox
Is there a way to modify this code so that it pastes both the values from columns 10 & 11?
It is taking the value from column 10 of the Listbox
Is there a way to modify this code so that it pastes both the values from columns 10 & 11?
Code:
Private Sub CommandButton1_Click()
ListBox3.MultiSelect = fmMultiSelectMulti
'Loop through every item in the ListBox
For i = 0 To ListBox3.ListCount - 1
'Check if the item was selected.
If ListBox3.Selected(i) Then
'If here, means this item has been selected.
'Put all selected items in Column B
With Sheets("Selected Tasks")
If Len(.Range("B11").Value) = 0 Then
.Range("B11").Value = ListBox3.List(i, 11)
Else
.Range("B" & .Rows.Count).End(xlUp).Offset(1).Value = ListBox3.List(i, 11)
End If
End With
End If
Next i
UserForm3.Hide
End Sub