Belleke
Well-Known Member
Hello,
I want to populate a listBox with the rows where column B contains Yes, the rest schould not be in the listbox. Column A:D
I have this code but it does not work
Please advice
I want to populate a listBox with the rows where column B contains Yes, the rest schould not be in the listbox. Column A:D
I have this code but it does not work
Code:
Private Sub CheckBox1_Click()
Dim r As Long
Dim m As Long
Dim wsh As Worksheet
Set wsh = Worksheets("Facturen")
If CheckBox1.Value = True Then
ListBox1.Clear
m = wsh.Range("B" & wsh.Rows.Count).End(xlUp).Row
For r = 2 To m
If wsh.Range("B" & r).Value = "Yes" Then
Me.ListBox1.AddItem wsh.Range("B" & r)
End If
Next r
End If
End Sub