Loop through userform

  • Thread starter Thread starter Paul Morgan
  • Start date Start date
P

Paul Morgan

I have a userform with 7 ListBoxes
6 listboxes are populated by the selection made from ListBox1(some
ListBoxes do not get populated all the time)
How can I clear(reset) ListBoxes 2 to 7, because some selections will
populate all the list boxes and some will only populate 1 or 2
listboxes, if a selection is made that populates all the listboxes,
then another is made that only populates 1 listbox, the other
listboxes are still populated because of not being cleared(reset)

Thanks
 
ListBox'es have a Clear method which will remove the items in them. For
example,

ListBox2.Clear

should remove all the items in ListBox2.

Rick
 
Thanks or the reply,
That is the logical way to do it, but I am getting an unspecified
error,
I have used this
Private Sub CommandButton8_Click()
ListBox2.Clear
ListBox3.Clear
ListBox4.Clear
ListBox5.Clear
ListBox6.Clear
ListBox7.Clear
End Sub

and this
Sub ClearListBox()
'On Error Resume Next
With UserForm1
..ListBox2.Clear
..ListBox3.Clear
..ListBox4.Clear
..ListBox5.Clear
..ListBox6.Clear
..ListBox7.Clear
End With

both codes result in Unspecified errors

If I use the error code then nothing happens at all....
 
Back
Top