ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select listbox item (https://www.excelbanter.com/excel-programming/397929-select-listbox-item.html)

geebee

select listbox item
 
hi,

i would like to know how i can select a listbox item using vba. i tried:

for x = 0to sheets("sheet1").listname,listcount - 1
sheets("sheet1").listname.item.select
next x

but it doesnt work

can someone help me?

thanks in dvance,
geebee


Leith Ross[_2_]

select listbox item
 
On Sep 21, 9:54 am, geebee (noSPAMs) wrote:
hi,

i would like to know how i can select a listbox item using vba. i tried:

for x = 0to sheets("sheet1").listname,listcount - 1
sheets("sheet1").listname.item.select
next x

but it doesnt work

can someone help me?

thanks in dvance,
geebee


Hello Geebee,

When using a Forms type ListBox, you can only select an item either by
clicking, or by changing the value of the Linked Cell. This examples
assumes the Linked Cell is A1, and the list box is named "List Box 1".
It selects the third item in the list.

With ActiveSheet
.Range("A1").Value = 3
With .ListBoxes("List Box 1")
X = .List(.ListIndex)
End With
End With

Sincerely,
Leith Ross



All times are GMT +1. The time now is 10:22 AM.

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