Excel VBA UserForm Listbox Clear All Items

preview_player
Показать описание
Excel VBA UserForm Listbox Learn how to clear all the items

The source code used in this video:

Private Sub cbRemove_Click()

For i = lbDays.ListCount - 1 To 0 Step -1
If lbDays.Selected(i) Then lbDays.RemoveItem (i)
Next i

End Sub

Private Sub cbRemoveAll_Click()
lbDays.Clear
End Sub

Private Sub UserForm_Initialize()

With lbDays
.AddItem "Monday"
.AddItem "Tuesday"
.AddItem "Wednesday"
End With
Рекомендации по теме
Комментарии
Автор

Muchas gracias, Tu video es perfecto. La información es precisa!

italoperalta
Автор

Hi In a Office, I have office 2010 but the clear method foes not work with me, what version do you use ?

paraglide
Автор

So how can I make items in Listbox undeleteable?

khentrebleza