ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox question please (https://www.excelbanter.com/excel-programming/385516-listbox-question-please.html)

kirkm[_6_]

Listbox question please
 

What should the command ...

Me.List1.ListIndex = t

.... actually do ?

Should it set line t as the selected line in the list box, and also be
highlit ... or not ?

Thanks - Kirk

kirkm[_6_]

Listbox question please
 
On Sun, 18 Mar 2007 23:46:33 +1200, kirkm
wrote:

A little bit later I substituted

List1.Selected(t) = True

This seemed to work better and I first
thought you don't set List1.listIndex= anything.

List1.Selected(t) by itself is all that required.

However, this also fails about 1 time in 12.

For an experiment I added

List1.Selected(t) = True
Do
Loop Until List1.Selected(t) = True
MsgBox List1.Selected(t)


Every time row t was highlit, the msgbox output was True.

But also, when it *wasn't* highlit, it also said True.

Does this make sense to anyone?

Thanks - Kirk

JLGWhiz

Listbox question please
 
There is a pretty comprehensive explanation for the selected property in VBA
help. There are also example code snippets.

"kirkm" wrote:

On Sun, 18 Mar 2007 23:46:33 +1200, kirkm
wrote:

A little bit later I substituted

List1.Selected(t) = True

This seemed to work better and I first
thought you don't set List1.listIndex= anything.

List1.Selected(t) by itself is all that required.

However, this also fails about 1 time in 12.

For an experiment I added

List1.Selected(t) = True
Do
Loop Until List1.Selected(t) = True
MsgBox List1.Selected(t)


Every time row t was highlit, the msgbox output was True.

But also, when it *wasn't* highlit, it also said True.

Does this make sense to anyone?

Thanks - Kirk



All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com