palaeontology
Active Member
- Joined
- May 12, 2017
- Messages
- 444
- Office Version
- 2016
- Platform
- Windows
I have a UserForm ListBox that has two columns.
I'm currently using the following code that, when an entry in the ListBox is clicked, the code will send the contents of the left column of the ListBox to PrintTemplate!V49 (and downwards), and the 2nd column information to PrintTemplate!W49 (and downwards).
I now just want to send the second column information to PrintTemplate!V49 (and downwards) ... I no longer want the first column value to be sent anywhere.
How would I adjust this code ?
I'm currently using the following code that, when an entry in the ListBox is clicked, the code will send the contents of the left column of the ListBox to PrintTemplate!V49 (and downwards), and the 2nd column information to PrintTemplate!W49 (and downwards).
Code:
Private Sub CommandButton3_Click()Dim Addme As Range
Dim x As Integer
If IsEmpty(Sheets("PrintTemplate").Range("V49")) Then
Set Addme = Sheets("PrintTemplate").Range("V49")
Else
Set Addme = Sheets("PrintTemplate").Range("V" & Rows.Count).End(xlUp).Offset(1, 0)
End If
For x = 0 To Me.ListBox_1st_Class.ListCount - 1
If Me.ListBox_1st_Class.Selected(x) Then
Addme = Me.ListBox_1st_Class.List(x)
Addme.Offset(, 1).Value = Me.ListBox_1st_Class.List(x, 1)
Set Addme = Addme.Offset(1, 0)
End If
Next x
For x = 0 To Me.ListBox_1st_Class.ListCount - 1
If Me.ListBox_1st_Class.Selected(x) Then Me.ListBox_1st_Class.Selected(x) = False
Next x
I now just want to send the second column information to PrintTemplate!V49 (and downwards) ... I no longer want the first column value to be sent anywhere.
How would I adjust this code ?