Reset listbox selection in VBA

前端 未结 5 476
渐次进展
渐次进展 2021-01-18 18:08

I\'m trying to \'reset\' a listbox in Excel VBA when a form closes. Currently when I use the userform1.hide function the form disappears but when I open it up again using th

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 18:12

    You could use

    Private Sub clearListBox()
     'Clears the listbox
        Do Until ListBox1.ListCount = 0
            Me!ListBox1.RemoveItem(0)
        Loop
    End Sub
    

提交回复
热议问题