Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good morning, hope you can help me please, i have a Userform1 which has a listbox1 and listbox2 in it, i have a command button for listbox1, for when this is clicked i want it to remove the row selected and move it into listbox2 i have the code below but it is not working, i have a background of yellow on a line of code 'Me.ListBox2.AddItem Me.ListBox1.List(iCnt)'. hope you can help me please.
VBA Code:
Private Sub CommandButton8_Click()
'Variable Declaration
Dim iCnt As Integer
'Move Items from ListBox1 to ListBox2
For iCnt = 0 To Me.ListBox1.ListCount - 1
Me.ListBox2.AddItem Me.ListBox1.List(iCnt)
Next iCnt
'Clear ListBox1 After moving Items from ListBox1 to ListBox2
Me.ListBox1.Clear
End Sub