I have a customer table with several columns. One column (19) states whether the customer is still active or not.
I would like to populate a listbox with columns 1, 2 and 3 based on a condition in column 19.
It is my first time that I'm populating a listbox with a condition.
Sub LoadShops(Optional ShowAll As Boolean)
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Shops")
Dim cl As Range
Dim i As Integer
If ShowAll = True Then
For Each cl In ws.Range("tblShops").Columns(3).Cells 'display shop name
If cl.Offset(, 19) = True Then
.List(i, 0) = cl.Offset(, -2).Value
.List(i, 1) = cl.Offset(, -1).Value
.List(i, 2) = cl.Value
i = i + 1
Is there another way to populate the data?