Private Sub CommandButton1_Click()
For Each s In Worksheets("sheet2").range("a1:a100")
If s.Value = ListBox1.Value Then
x = s.Offset(0, 1).Value
Sheets(x).Activate
ListBox2.rowsource = Sheets(x).range("a1:i10000")
End If
Next s
exit sub
This code finds a sheet from a selection in listbox1 when the user clicks the commandbutton. Why cant I figure out why I cant get the range A1:I10000 of that sheet to display in listbox2 ????
Please help
For Each s In Worksheets("sheet2").range("a1:a100")
If s.Value = ListBox1.Value Then
x = s.Offset(0, 1).Value
Sheets(x).Activate
ListBox2.rowsource = Sheets(x).range("a1:i10000")
End If
Next s
exit sub
This code finds a sheet from a selection in listbox1 when the user clicks the commandbutton. Why cant I figure out why I cant get the range A1:I10000 of that sheet to display in listbox2 ????
Please help