View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Danny[_13_] Danny[_13_] is offline
external usenet poster
 
Posts: 16
Default 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
_______________________________________