Hi All,
I have a user form with 2 list boxes, the left box is populated and the right is blank, users will select values on the left and move them to the right list box.
When they hit the command button I want all the selected items in the right list box (ListBox2) to populate an array that I can then use to filter the data in the workbook.
Here is my code so far, it errors on the line 'ListBox2.List = LArray'. Any help would be greatly appreciated.
I have a user form with 2 list boxes, the left box is populated and the right is blank, users will select values on the left and move them to the right list box.
When they hit the command button I want all the selected items in the right list box (ListBox2) to populate an array that I can then use to filter the data in the workbook.
Here is my code so far, it errors on the line 'ListBox2.List = LArray'. Any help would be greatly appreciated.
Code:
Private Sub cmdSelect_Click()
Dim LArray As Long
Dim lrow, LRowII As Long
ListBox2.List = LArray
Dim ds, ws As Worksheet
Set ws = Sheet2
Set ds = Sheets("Excluded Data")
lrow = ws.Cells(ws.Rows.Count, "A:A").End(xlUp).Row
LRowII = ds.Cells(ds.Rows.Count, "A:A").End(xlUp).Row
With ds
.Range("$A:$HH").AutoFilter field:=1, Criteria1:=LArray
.Range("$A$2:$HH$" & LRowII).SpecialCells(xlCellTypeVisible).Copy Destination:=ws.Range("A" & lrow + 1)
.Range("$A$2:$HH$" & LRowII).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.ShowAllData
End With
End Sub