A method that will update a specific ListBox (whose listfillrange is a named range with a dynamic size) is attached to a Sheet on which I have an ActiveX List Box. The first sheet of the Microsoft Excel Objects contains all of the following code.
Function to update ListBox
Private Sub update(lst As ListBox)
lst.ListIndex = -1
lst.ListFillRange = lst.ListFillRange
End Sub
I want to call this function in two scenarios:
- When the Worksheet changes:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect("{some ranges}") Is Nothing Then update Me.ListBox
End Sub
- When a different ListBox is clicked on:
Private Sub OtherListBox_Click()
update Me.ListBox
End Sub
However when the code tries to call the update sub it gives me a Type Mismatch error on the update line This is my first time using List Boxes, so my understanding is pretty limited and I can't understand why both scenarios won't work