Search code examples
vbauserform

Automatically Check all ListBox options when opening a UserForm


I have a ListBox called ListBox1 and I want to select all of the values automatically when opening the form. How can I do this?

My ListBox looks something like this

enter image description here


Solution

  • Use For Loop and embed it in userform initialise event.....

    For i = 0 To MyListBox1.ListCount - 1 
        MyListBox1.Selected(i) = True
    Next i 
    

    This might help.