Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a large Listbox in a Userform that has 5 columns and can have up
to 1200 row entries. I have run into a curious behavior. I have buttons to Select all entries in the Listbox and to Clear all selections in the Listbox. My code is virtually idential to do the Select All and Clear All. Here's the curious part: when I have ~ 1000 rows in the Listbox, it takes ~ 3 seconds to do a Clear All, but only ~ 1 second to do the Select All. With a small number of rows, it impossible to see any difference, but with a large number of entries it takes noticeably longer to do the clear I have written the Clear All code as fast as I can think of (no calculations within the loop). I also tried turning off screen updating and calculations, but it doesn't seem to make any difference. Does anyone know of a faster way to do the clear? Here is my code. Private Sub btnClearAll_Click() Dim I As Integer Dim count As Integer With NameForm.ListBox1 count = .ListCount - 1 For I = 0 To count .Selected(I) = False Next I End With End Sub The only difference between the Clear All code and the Select All codeis False/True in line .Selected(I) = False. Any ideas? Why would be it faster to do the selection? Any info would be appreciated, Thanks, Jim |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How To Clear Previous Selection From a Drop Down | Excel Discussion (Misc queries) | |||
How do I clear a print area when the selection is grayed out? | Excel Discussion (Misc queries) | |||
ListBox selection | Excel Programming | |||
How to clear a selection | Excel Programming | |||
How to Clear value a listbox! | Excel Programming |