Hi there,

I have a listbox in a userform that is populated from an array, please see image below;

Untitled.png

I have a second userform with 3 buttons that sets the DataRetrieval to the word "Supplier" (DataRetrieval is Public to string in a module), I'm trying to select the particular elements of the listbox (listbox name = listbox01) to match against another criteria to populate a second listbox (listbox name = listbox02), but I keep getting an error message 13 type mismatch, can anyone help

Stockdata refers to a sheets("Stock_Data").Range("A2:V46")

Code;

SuppCustQuest.Show

    x = ListBox01.ListIndex
    y = ListBox02.ListCount

If DataRetrieval = "Supplier" Then
    For n = 1 To StockData.Rows.Count
    If StockData.Cells(n, 4) = ListBox01(x, 1) Then
    ListBox02.AddItem "DOP: " & StockData.Cells(n, 2)
    ListBox2.List(y, 1) = "Vehicle: " & StockData.Cells(n, 6) & " " & StockData.Cells(n, 7) & " " & StockData.Cells(n, 8)
    ListBox2.List(y, 2) = "Reg: " & StockData.Cells(n, 5)
    End If
    Next n
End If