0

I have a table 1 as shown below which I want to use to populate a listbox.

Table1

I would like to loop through the table, column heading "Customer Name", to populate the listbox.

Please see the code below.

For i = 1 To Sheets("Sheet1").Range("Table").Rows.count
If Range("Table[Customer Name]")(i) = a Then frmFeee.lstCust.RowSource = Sheets("Sheet1").Range("A" & i & ": D" & i)
      
Next i

Any help is greatly appreciated.

Thank you.

5
  • Where is your freFeee? and are you trying to give rosource for listbox as multiple columns? Commented Jul 28, 2021 at 4:45
  • If filter can be used, refer populating list from filter Commented Jul 28, 2021 at 5:04
  • Hi Bharat, thank you for your comment. my frmFeee is just a framework that contains a listbox "lstCust". Yes I'm trying to have a multiple columns within my listbox. Commented Jul 28, 2021 at 5:37
  • What exactly is your question and how is your code not working? Commented Jul 28, 2021 at 6:55
  • You can use an advanced filter to copy columns you want to another page. Create a named range with the use of OFFSET function and then assign the named range to the RowSource property of your listbox. Commented Jul 28, 2021 at 15:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.