View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_2_] Leith Ross[_2_] is offline
external usenet poster
 
Posts: 128
Default 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