Hello,
I've got a user form with 2 listboxes - The first box populates a listing of names of worksheets. When clicking on one name then a button I would like to populate the data from that sheet into a second list box (about 10 rows and 12 columns of data only)
When changing the name of listbox1 then clicking show I'd like that data to change...
I'm new and can't seem to figure this out - I'm sure its an easy syntax that I can't quite get...Please help... This is what I have so far...
I've got a user form with 2 listboxes - The first box populates a listing of names of worksheets. When clicking on one name then a button I would like to populate the data from that sheet into a second list box (about 10 rows and 12 columns of data only)
When changing the name of listbox1 then clicking show I'd like that data to change...
I'm new and can't seem to figure this out - I'm sure its an easy syntax that I can't quite get...Please help... This is what I have so far...
Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = xlSheetVisible Then
ListBox1.AddItem ws.Name
End If
Next ws
TextBox1 = ListBox1.Value
End Sub
Private Sub ListBox1_Click()
Label1.Caption = Sheets(ListBox1.Value).Range("A1").Value
End Sub
Private Sub CommandButton1_Click()
Dim ws As Worksheet
With ListBox2
Sheets(ListBox1.Value).Select [B][SIZE="4"] (is this line right?)
(where do I go from here?)[/SIZE][/B]
End With
End Sub
Last edited: