Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any more effective method to get selected item in Listbox?
Hi,
I have a question about the Userform.listbox I would like to make a userform, which has 2 listbox. The first one (listbox1) is showing the sheet name in workbook. Another (listbox2) is showing the range(cells(1,1),cells(1,1).end(xltoright).column) of select sheet name (selected at listbox1) my normal practice to get selected item in listbox is below. Any more effective method? _______________________________________ k = userform.lisbox1.ListCount j = 1 For i = 1 To k If userform.lisbox1.Selected(i - 1) = True Then ReDim Preserve Array(j) Array(j) = i j = j + 1 End If Next i _______________________________________ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any more effective method to get selected item in Listbox?
[either Value or Text will get the data. Listindex will get the item numbver in the list with the first one = 0. Setting ListIndex to -1 will deselect all items. -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=176311 Microsoft Office Help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any more effective method to get selected item in Listbox?
Listbox1.Value
HTH Bob "Danny" wrote in message ... Hi, I have a question about the Userform.listbox I would like to make a userform, which has 2 listbox. The first one (listbox1) is showing the sheet name in workbook. Another (listbox2) is showing the range(cells(1,1),cells(1,1).end(xltoright).column) of select sheet name (selected at listbox1) my normal practice to get selected item in listbox is below. Any more effective method? _______________________________________ k = userform.lisbox1.ListCount j = 1 For i = 1 To k If userform.lisbox1.Selected(i - 1) = True Then ReDim Preserve Array(j) Array(j) = i j = j + 1 End If Next i _______________________________________ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any more effective method to get selected item in Listbox?
Thank you all,
how about if the selected items is more than one? Must need the loop to determine? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any more effective method to get selected item in Listbox?
IF more than one, yes you have to loop and pick them out.
HTH Bob "Danny" wrote in message ... Thank you all, how about if the selected items is more than one? Must need the loop to determine? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selected listbox item | Excel Programming | |||
Selected ListBox item to TextBox | Excel Programming | |||
Worksheet Listbox selected item? | Excel Programming | |||
Delete selected Item from listbox | Excel Programming | |||
How to get the index in VBA of the selected item in a ListBox | Excel Programming |