Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
highlighting different line in a cell krv Excel Worksheet Functions 2 February 17th 10 08:00 PM
Vertical Highlighting on line graph??? Jon M Charts and Charting in Excel 1 February 15th 09 06:18 PM
Vertical highlighting in line graphs???? Jon M Charts and Charting in Excel 0 February 15th 09 05:07 PM
highlighting different sections of a line chart Oliver S Charts and Charting in Excel 1 November 3rd 06 05:09 PM
Highlighting Duplicates in a List John Mansfield[_2_] Excel Programming 2 September 2nd 04 08:48 PM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"