I want to populate a vba listbox from a database only with specific rows. This is what I got.
Private Sub UserForm_Initialize()
Hoja2.Activate
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "70;90;90;90;70"
ListBox1.AddItem "FIRST NAME"
ListBox1.List(0, 1) = "LAST NAME"
ListBox1.List(0, 2) = "LAST NAME 2"
ListBox1.List(0, 3) = "BORN DATE"
ListBox1.List(0, 4) = "AGE"
Dim seguimiento As Integer
Dim i As Integer
seguimiento = Application.WorksheetFunction.CountA(Range("b:b"))
For i = 1 To seguimiento
If Cells(i, 20) = "" Then
ListBox1.AddItem Cells(i, 3)
Else
End If
Next i
End Sub`
it's actually hard to understand listbox filling criteria from your question
assuming you want to fill listbox with cells:
try the following code: