I am currently teaching myself VBA and how to create my own userforms.
I have been following these handy tutorials here (link: http://www.excel-easy.com/vba/…-list-box-selections.html).
This tutorial walks you through how to create a userform which allows a user to select some items in List Box 1 and then add/ remove them from List Box 2. I want to add some additional functionality to this userform by allowing a user to 'print' or 'transfer' their selections in List Box 2 to a table in a sheet.
I have tried to 'transfer' the data into the first empty row on Sheet1 by using this code (ref link: http://www.excel-easy.com/vba/userform.html)
Private Sub OKButton_Click()
Dim emptyRow As Long
'Make Sheet1 active
Sheet1.Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer information
Cells(emptyRow, 1).Value = ListBox2.Value
Display More
But a) it does not work when I click 'OK' and b) I suspect it's missing something in order to transfer all the selections in List Box 2
Any help on this topic would be much appreciated.