![]() |
Highlighting first line in list box
Could someone please explain how to consistently set the first
item in the list box to selected (i.e. highlit) without needing to click on it? I've tried List1.Selected(0) = True and list1.listindex = 0 Both *seemed* to work, but occasionaly fail. Thanks - Kirk PS it's not a MultiSelect listbox. |
Highlighting first line in list box
Hi,
Do you put the focus on the listBox ? Regards JY "kirkm" wrote in message ... Could someone please explain how to consistently set the first item in the list box to selected (i.e. highlit) without needing to click on it? I've tried List1.Selected(0) = True and list1.listindex = 0 Both *seemed* to work, but occasionaly fail. Thanks - Kirk PS it's not a MultiSelect listbox. |
Highlighting first line in list box
On Mon, 12 Mar 2007 14:33:45 +0100, "Jean-Yves"
wrote: Hi, Do you put the focus on the listBox ? Regards JY Hi JY, Thanks for that suggestion, I've just applied it and not had a failure in 10 or 20 goes. I had assumed the listbox *would* have the focus in it's own Enter event. Private Sub List1_Enter() List1.SetFocus <<<< New line List1.Selected(0) = True End Sub I proved List1.Selected was working as substituting another number for (0) sees the slection change to that line. Why it sometimes didn't work I couldn't figure.... hope this fixes it. Thanks - Kirk "kirkm" wrote in message .. . Could someone please explain how to consistently set the first item in the list box to selected (i.e. highlit) without needing to click on it? I've tried List1.Selected(0) = True and list1.listindex = 0 Both *seemed* to work, but occasionaly fail. Thanks - Kirk PS it's not a MultiSelect listbox. |
All times are GMT +1. The time now is 01:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com