I have this code for a texbox to search into a listbox
It's working properly but sometimes it doesn't look at all the names in the list.. probably because some of the rows are hidden?

Private Sub TextBox2_Change()
Dim arrResult As Variant

    If IsEmpty(arrnames) Then
        arrnames = Range("AC1", Range("AC" & Rows.Count).End(xlUp))
        arrnames = Application.Transpose(arrnames)
    End If
    
    If TextBox2.Value <> "" Then

        arrResult = Filter(arrnames, TextBox2.Value, True, vbTextCompare)
        ListBox2.List = arrResult
    Else
        ListBox2.List = arrnames
    End If

End Sub
I think the solution will be for the Rows.Count to also look at hidden rows.
Or I can try to move the name list to another sheet and make the code refer to that, but I could not find the proper way to make it look at Sheets("Sheet2") and AC column, for example.
Thanks for your time.