list box selection?
Hi
I'm confused. How many listboxes are being changed? Are you selecting
one listbox (sheetname) and then want the list items in another listbox
to be based on that sheet?
You talk about "the listbox" but you seem to want to select sheetnames
AND data on a sheet???
Can you just clarify what you want to see in all listboxes and what you
do to make list data change.
regards
Paul
Hazel wrote:
Hi Paul
Have done as you suggested however it still changes the sheet from JBloggs
to ASmith but the List box data does not change it remains showing JBloggs
instead of ASmith data any other clues has how to change the list box data
when changing the Com1 selection.
--
Many thanks
hazel
" wrote:
Hi
In your UserForm_Initialise() sub insert
Me.ListBox1.Rowsource = Sheet1!A1:A5
to populate Listbox1 with data in range A1 to A5 on sheet1.
regards
Paul
Hazel wrote:
Hi All
I'm using a userform populated from the Row Source on the first sheet - I
have used a snippet of code off this forum to change the sheet in the
workbook thats OK how do I then populate the list box from the new sheet. Its
only a simple form so have included all the code being used below.
Option Explicit
Private Sub UserForm_Initialise()
Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3) =
Me.Tb1.Value
End Sub
Private Sub Add1_Click()
If Me.Lb1.ListIndex -1 Then
Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3) =
Me.Tb1.Value
End If
End Sub
Private Sub Lb1_Click()
Tb1.Value = ""
End Sub
Private Sub UserForm_Activate()
Com1.Value = "Select Members Sheet"
Com1.AddItem "JBloggs"
Com1.AddItem "ASmith"
End Sub
Private Sub Com1_Click()
If Com1.ListIndex < -1 Then
Worksheets(Com1.Value).Select
End If
End Sub
--
Many thanks
hazel
|