View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
64-bit Newbie 64-bit Newbie is offline
external usenet poster
 
Posts: 5
Default "For" help (I think?)

Good morning all-

I have a quick question for you concerning a selecting an item out of a
listbox, allowing another userform pop up. In listbox1, I have 51 line
items, with a SelectButton and a CancelButton. What would be a good code for
the following:

If listindex 1 is selected, then show userform1...
If listindex 2 is selected, then show userform2...
If listindex 51 is selected, then show userform51

I'm thinking something along the lines of:

Private Sub SelectButton_Click()
Dim I as Integer
For I = 1 to 51
if listbox1.selected(I) then
userform(I).open
end if
next I
End Sub

How far am I off the beaten track here?