Hi. New to the forum. Hopefully someone can help me out here. I'm using Excel and have a userform that has a series of listboxes. What I want is for the user to be able to select a value in one listbox and then have the corresponding values from the other listboxes selected as a result. What I'm trying to do is capture the listbox1.listindex from the one and then store it as variable "workindex". Then I use workindex to select the values in the other listboxes using ListBox2.Selected(workindex). Here is the actual code where I've inserted message boxes to display the results.
the messagebox for workindex always displays the correct number. The first time I ran this routine, the other messageboxes displayed the right info. Then after that, they no longer worked and always came up blank. Any help would be appreciated.HTML Code:Private Sub ListBox1_Click() Dim work, quote, CETTab, ID, workcount, workindex As Variant Dim X, Y, z As Variant work = ListBox1.Value workindex = ListBox1.ListIndex MsgBox workindex ListBox2.Selected(workindex) = True ' MsgBox ListBox2.Value ID = ListBox2.Value MsgBox ID End Sub
Please Help!




Reply With Quote