Hi all,
in the following code, for testing purposes, I have success in writing the data from a userform to all 5 sheets as specified in MyArr...
Private Sub PS1()
Application.ScreenUpdating = False
On Error Resume Next
Dim MyArr As Variant
Dim a As Long
MyArr = Array("Round 1", "Round 2", "Round 3", "Round 4", "Round 5")
For a = LBound(MyArr) To UBound(MyArr)
Sheets(MyArr(a)).Select
With Sheets(MyArr(a))
Dim srNextRow&, strListBox1$, i%
strListBox1 = ""
LR = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 0 To ListBox21.ListCount - 1
If ListBox21.Selected(i) = True Then strListBox1 = strListBox1 & ListBox21.List(i)
Range("A" & LR & ".I" & LR).Value = Array(strListBox1, ListBox1.Text, TextBox15.Text, TextBox1.Text, TextBox11.Text, TextBox12.Text, TextBox16.Text, TextBox14.Text, TextBox13.Text)
Next i
End With
Next a
Application.ScreenUpdating = True
End Sub
What I would like to happen, however, is for the data to be written to one specific worksheet, that worksheet being one of the selections from a listbox (ListBox1 in this case). After trying some variations on ListBox.Selected, Listbox.ListCount, and ListBox.ListIndex, I'm no closer to getting it to work, and again, I think I'm just having problems with the syntax of it all.
ListBox1 Item 1 = Round 1
ListBox1 Item 2 = Round 2
etc
Anyone got some suggestions for me?
Cheers,
AJ
Bookmarks