Hi Guys
On my Userform I have 10 listboxes populated from the excel sheet. I have another listbox(listbox11) where I would like to selected a random item from listbox1 add to listbox11 and delete the item from listbox1 to listbox10.
The code at the current moment works partially. It directly skips to listbox10 Please can you help so the code works completely.Dim afound as boolean lIndex as interger lIndex = Int(Rnd * Listbox1.ListCount) Textbox1.text = Listbox1.List(lIndex) UserForm1.LsbDay1.AddItem (UserForm1.Textbox1.text) Listbox1.RemoveItem (lIndex) aFound = False intIndex = 0 Do While Not aFound And intIndex < Listbox2.ListCount If UCase(Left(Listbox2.List(intIndex), Len(Textbox1.text))) = UCase(Textbox1.text) Then Listbox2.ListIndex = intIndex aFound = True Listbox2.RemoveItem (intIndex) End If intIndex = intIndex + 1 Loop Do While Not aFound And intIndex < Listbox3.ListCount If UCase(Left(Listbox3.List(intIndex), Len(Textbox1.text))) = UCase(Textbox1.text) Then Listbox3.ListIndex = intIndex aFound = True Listbox3.RemoveItem (intIndex) End If intIndex = intIndex + 1 Loop Do While Not aFound And intIndex < Listbox4.ListCount If UCase(Left(Listbox4.List(intIndex), Len(Textbox1.text))) = UCase(Textbox1.text) Then Listbox4.ListIndex = intIndex aFound = True Listbox4.RemoveItem (intIndex) End If intIndex = intIndex + 1 Loop etc
Bookmarks