I'm trying to write a code block that would change the Rowsource property of a userform listbox for each change of the Listbox selection. Something like this:
Both the Change Event and the Click Event must refer to and use the Rowsource in the selected Case statement - that is the current Listbox selected value. So the Rowource would change with each change in the selected value of the Listbox. Below is the sheet data.
Row data for some rows extends out to but not past column T.
I ‘m initially placing the Select Case End Select in the Userform Activate Event.
This Click Event code would use the correct Rowsource of the Listbox selection:
Not sure of exactly where to put the Select End Select case statement.
Any help would be very appreciated.
Thanks, cr
Code:
Select case m.
Case Is = "Isaiah 25:8"
ListBox2.RowSource = Sheets("PROPHLINKS2").Range("A1:T1")
'Case Is = "Isaiah 26:19"
'ListBox2.RowSource = Sheets("PROPHLINKS2").Range("A2:T2")
...
End Select
Both the Change Event and the Click Event must refer to and use the Rowsource in the selected Case statement - that is the current Listbox selected value. So the Rowource would change with each change in the selected value of the Listbox. Below is the sheet data.
Row data for some rows extends out to but not past column T.
I ‘m initially placing the Select Case End Select in the Userform Activate Event.
This Click Event code would use the correct Rowsource of the Listbox selection:
Code:
Private Sub ListBox2_Click()
Dim n As Long
n = ListBox2.ListIndex
TextBox1.Value = ListBox2.List(n, 0) _
& vbCrLf + ListBox2.List(n, 1) _
& vbCrLf _
& ListBox2.List(n, 2) _
& vbCrLf _
& vbCrLf + ListBox2.List(n, 3)
...
End Sub
Any help would be very appreciated.
Thanks, cr