Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a listbox
I have a listbox loaded from addItem.
The listbox is on a userform. There comes a moment in the program when I want the listbox to unload what is in the listbox and reuse the same listbox so I can add different items. Is there a fast way to do that, without unloading the form? Or is the a way to quickly clear a listbox contents and repopulate it with other items? -- wbnTravis, from Oklahoma |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a listbox
Listbox1.Clear
Corey..... "wbntravis" wrote in message ... I have a listbox loaded from addItem. The listbox is on a userform. There comes a moment in the program when I want the listbox to unload what is in the listbox and reuse the same listbox so I can add different items. Is there a fast way to do that, without unloading the form? Or is the a way to quickly clear a listbox contents and repopulate it with other items? -- wbnTravis, from Oklahoma |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a listbox
From VB Help:
expression.RemoveItem(Index, Count) expression An expression that returns a ControlFormat object. Index Required Long. The number of the first item to be removed. Valid values are from 1 to the number of items in the list (returned by the ListCount property). Count Optional Variant. The number of items to be removed, starting at item Index. If this argument is omitted, one item is removed. If Index + Count exceeds the number of items in the list, all items from Index through the end of the list are removed without an error. -- Ian -- "wbntravis" wrote in message ... I have a listbox loaded from addItem. The listbox is on a userform. There comes a moment in the program when I want the listbox to unload what is in the listbox and reuse the same listbox so I can add different items. Is there a fast way to do that, without unloading the form? Or is the a way to quickly clear a listbox contents and repopulate it with other items? -- wbnTravis, from Oklahoma |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a listbox
Thanks IanC and Corey.... each gave me a different perspective
and I will use both where needed or where I want to experiment . : ) -- wbnTravis, from Oklahoma "IanC" wrote: From VB Help: expression.RemoveItem(Index, Count) expression An expression that returns a ControlFormat object. Index Required Long. The number of the first item to be removed. Valid values are from 1 to the number of items in the list (returned by the ListCount property). Count Optional Variant. The number of items to be removed, starting at item Index. If this argument is omitted, one item is removed. If Index + Count exceeds the number of items in the list, all items from Index through the end of the list are removed without an error. -- Ian -- "wbntravis" wrote in message ... I have a listbox loaded from addItem. The listbox is on a userform. There comes a moment in the program when I want the listbox to unload what is in the listbox and reuse the same listbox so I can add different items. Is there a fast way to do that, without unloading the form? Or is the a way to quickly clear a listbox contents and repopulate it with other items? -- wbnTravis, from Oklahoma |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clearing cells without clearing formulas | Excel Discussion (Misc queries) | |||
Clearing listbox | Excel Programming | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |