select listbox item

G

Guest

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
 
L

Leith Ross

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top