ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Box Question (https://www.excelbanter.com/excel-programming/341046-list-box-question.html)

Jeff Wright[_2_]

List Box Question
 
Good morning, all !

I have a user form with a list box. The contents of the list box change
according to the range name shown in the row source property. When I run the
user form, the contents of the list box do change as I want them to, but no
"default" item is selected. I'd like the first item to be selected each time
the contents of the list box changes, but I don't know how to do this. Your
help is appreciated.

Thanks !!

Jeff



Peter[_55_]

List Box Question
 
Hi Jeff,

You could try
ListBox1.ListIndex = 1
The "1" referes to the first item in your list.

Regards,
Peter

"Jeff Wright" schreef in bericht
news:2lzZe.267314$E95.61233@fed1read01...
Good morning, all !

I have a user form with a list box. The contents of the list box change
according to the range name shown in the row source property. When I run
the
user form, the contents of the list box do change as I want them to, but
no
"default" item is selected. I'd like the first item to be selected each
time
the contents of the list box changes, but I don't know how to do this.
Your
help is appreciated.

Thanks !!

Jeff





Chip Pearson

List Box Question
 
The "1" referes to the first item in your list.

The ListIndex property is 0 based. The first item in the list is
ListIndex = 0, and the last item is ListIndex = ListCount -1.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Peter" wrote in message
...
Hi Jeff,

You could try
ListBox1.ListIndex = 1
The "1" referes to the first item in your list.

Regards,
Peter

"Jeff Wright" schreef in bericht
news:2lzZe.267314$E95.61233@fed1read01...
Good morning, all !

I have a user form with a list box. The contents of the list
box change
according to the range name shown in the row source property.
When I run the
user form, the contents of the list box do change as I want
them to, but no
"default" item is selected. I'd like the first item to be
selected each time
the contents of the list box changes, but I don't know how to
do this. Your
help is appreciated.

Thanks !!

Jeff







Jeff Wright[_2_]

List Box Question
 
Peter,

I did try it, and it works! Thanks for much for your help on this!

Jeff

"Peter" wrote in message
...
Hi Jeff,

You could try
ListBox1.ListIndex = 1
The "1" referes to the first item in your list.

Regards,
Peter

"Jeff Wright" schreef in bericht
news:2lzZe.267314$E95.61233@fed1read01...
Good morning, all !

I have a user form with a list box. The contents of the list box change
according to the range name shown in the row source property. When I run
the
user form, the contents of the list box do change as I want them to, but
no
"default" item is selected. I'd like the first item to be selected each
time
the contents of the list box changes, but I don't know how to do this.
Your
help is appreciated.

Thanks !!

Jeff






Jeff Wright[_2_]

List Box Question
 
Chip, yes, after experimenting with it, I discovered that it is zero-based.

Thanks,

Jeff


"Chip Pearson" wrote in message
...
The "1" referes to the first item in your list.


The ListIndex property is 0 based. The first item in the list is
ListIndex = 0, and the last item is ListIndex = ListCount -1.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Peter" wrote in message
...
Hi Jeff,

You could try
ListBox1.ListIndex = 1
The "1" referes to the first item in your list.

Regards,
Peter

"Jeff Wright" schreef in bericht
news:2lzZe.267314$E95.61233@fed1read01...
Good morning, all !

I have a user form with a list box. The contents of the list
box change
according to the range name shown in the row source property.
When I run the
user form, the contents of the list box do change as I want
them to, but no
"default" item is selected. I'd like the first item to be
selected each time
the contents of the list box changes, but I don't know how to
do this. Your
help is appreciated.

Thanks !!

Jeff









All times are GMT +1. The time now is 02:17 AM.

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