Hi all,
I'm trying to create a userform with a listbox that populate from a dynamic range.
let's say that the range in validation!C2 has a list of tasks. In column D, I have initials of the person responsible for said task.
I would like to filter the listbox rows using checkbox.
So, if there are 4 people, I have 4 checkboxes with their initials. Their initials, as mentioned, is listed in column D next to the list of tasks.
So, if "JS" for John Smith is checked, I want to show in the listbox only the tasks assigned to him.
Basically, assuming I want the listbox to populate for "John Smith", I want the listbox source to show the equivalent of
=iferror(index(c2:c52,match(small(if(d2:d52="JS",e2:e52)),row()-2),e2:e52,0),1),"")
Where "JS" is the initials, C2:C52 is the list of all tasks, D2:D52 is the list of initials, and e2:e52 has =ROW() so I can run a =SMALL(range,k) to get list of all tasks assigned to JS, and the formula is entered in a cell in row 3, hence the nth smallest is row()-2.
(I made the above ranges static for simplicity).
I hope this is clear.
Thank you!
I'm trying to create a userform with a listbox that populate from a dynamic range.
Code:
Private Sub UserForm_Initialize()
With Listbox1
.RowSource = Range(Sheets("validation").Range("c2"), Sheets("validation").Range("c2").End(xlDown)).Address(, , , True)
.ColumnCount = 1
.MultiSelect = fmMultiSelectExtended
End With
End Sub
let's say that the range in validation!C2 has a list of tasks. In column D, I have initials of the person responsible for said task.
I would like to filter the listbox rows using checkbox.
So, if there are 4 people, I have 4 checkboxes with their initials. Their initials, as mentioned, is listed in column D next to the list of tasks.
So, if "JS" for John Smith is checked, I want to show in the listbox only the tasks assigned to him.
Basically, assuming I want the listbox to populate for "John Smith", I want the listbox source to show the equivalent of
=iferror(index(c2:c52,match(small(if(d2:d52="JS",e2:e52)),row()-2),e2:e52,0),1),"")
Where "JS" is the initials, C2:C52 is the list of all tasks, D2:D52 is the list of initials, and e2:e52 has =ROW() so I can run a =SMALL(range,k) to get list of all tasks assigned to JS, and the formula is entered in a cell in row 3, hence the nth smallest is row()-2.
(I made the above ranges static for simplicity).
I hope this is clear.
Thank you!