![]() |
How to Clear value a listbox!
Can anyone know the way to set a ListBox(Form) empty.
With the TextBox and Combox the Text property can read and write. But with the ListBox i think it only can read? Is there any way? --- Message posted from http://www.ExcelForum.com/ |
How to Clear value a listbox!
Is this something that you want ... ? This initialises a 2 column lis
box :- '- initialise form Private Sub UserForm_Initialize() Set DataSheet = ThisWorkbook.Worksheets("data") Set MyList = DataSheet.Range("FileList") Rw = 1 FileListBox.Clear While MyList.Cells(Rw, 1).Value < "" FileListBox.AddItem FileListBox.List(Rw - 1, 0) = MyList.Cells(Rw, 1).Value FileListBox.List(Rw - 1, 1) = MyList.Cells(Rw, 2).Value Rw = Rw + 1 Wend End Su -- Message posted from http://www.ExcelForum.com |
How to Clear value a listbox!
Did you want to unselect any selected items, or did you want to remove
all the items showing in the listbox? If the former, just use ListBox1.ListIndex = -1 If the latter, does your listbox have a rowsource, or is it populated with AddItem? -- HTH, Dianne Can anyone know the way to set a ListBox(Form) empty. With the TextBox and Combox the Text property can read and write. But with the ListBox i think it only can read? Is there any way? --- Message posted from http://www.ExcelForum.com/ |
How to Clear value a listbox!
What I mean is:
If I have a listbox1 which has a property List Range: A1:A3 A1=""; A2="1"; A3="2"; for example; The list box I resize it into one row(Which will has up and dow buttons). Assume I used down button to choose the value 2(A3). How can I set listbox1 appear blank. I can use: ListBox1.ListIndex = 0; But it only affect when the ListBox1 is selected! Help me -- Message posted from http://www.ExcelForum.com |
How to Clear value a listbox!
Listbox.ListIndex = -1
Listbox.TopIndex = 0 would show what is in cell A1 (which is blank). I believe that is what you mean. -- Regards, Tom Ogilvy bookworm98 wrote in message ... What I mean is: If I have a listbox1 which has a property List Range: A1:A3 A1=""; A2="1"; A3="2"; for example; The list box I resize it into one row(Which will has up and down buttons). Assume I used down button to choose the value 2(A3). How can I set listbox1 appear blank. I can use: ListBox1.ListIndex = 0; But it only affect when the ListBox1 is selected! Help me! --- Message posted from http://www.ExcelForum.com/ |
How to Clear value a listbox!
Thanks Tom,
ListBox.TopIndex = 0 What all I need! BEST WISHES, Tom Ogilvy wrote: *Listbox.ListIndex = -1 Listbox.TopIndex = 0 would show what is in cell A1 (which is blank). I believe that is what you mean. -- Regards, Tom Ogilvy bookworm98 wrote in message ... What I mean is: If I have a listbox1 which has a property List Range: A1:A3 A1=""; A2="1"; A3="2"; for example; The list box I resize it into one row(Which will has up and down buttons). Assume I used down button to choose the value 2(A3). How can I set listbox1 appear blank. I can use: ListBox1.ListIndex = 0; But it only affect when the ListBox1 is selected! Help me! --- Message posted from http://www.ExcelForum.com/ * --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 11:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com