Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi All,
I have a list box which displays the sheet names from 201 to 843(these are the names of the worksheets).What I need,when I click on command button if the checkbox1 is check then remove all the item less then 800 from the list. So far I made the below code but I only removes one item less than 800.How can I remove all the items less than 800É If CheckBox1.Value = True Then Dim i As Long For i = 0 To Me.ListBox1.ListCount - 1 If Me.ListBox1.List(i) < 800 Then Me.ListBox1.RemoveItem (i) Exit Sub End If Next i End If Thanks for help and happy new year. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If CheckBox1.Value = True Then
Dim i As Long For i = Me.ListBox1.ListCount - 1 To 0 Step -1 If Me.ListBox1.List(i) < 800 Then Me.ListBox1.RemoveItem (i) End If Next i End If -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ... hi All, I have a list box which displays the sheet names from 201 to 843(these are the names of the worksheets).What I need,when I click on command button if the checkbox1 is check then remove all the item less then 800 from the list. So far I made the below code but I only removes one item less than 800.How can I remove all the items less than 800É If CheckBox1.Value = True Then Dim i As Long For i = 0 To Me.ListBox1.ListCount - 1 If Me.ListBox1.List(i) < 800 Then Me.ListBox1.RemoveItem (i) Exit Sub End If Next i End If Thanks for help and happy new year. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove items from listbox together with add item | Excel Programming | |||
Remove Item from Listbox by Item Name | Excel Programming | |||
Double click item in Listbox to select item and close Listbox | Excel Programming | |||
remove item fr listbox (correction) | Excel Programming | |||
listbox remove Item | Excel Programming |