I have a user form with a multi select list box, when i press a button i want the selected criteria, from my list box, to appear in a text box below my list box. I've attached an example.
I have a user form with a multi select list box, when i press a button i want the selected criteria, from my list box, to appear in a text box below my list box. I've attached an example.
Try this...
![]()
Private Sub CommandButton1_Click() Dim i As Long, MyString As String With ListBox1 For i = 0 To .ListCount - 1 If .Selected(i) Then MyString = MyString & IIf(MyString = "", "", ", ") & .List(i) Next i End With Me.TextBox1.Text = MyString End Sub
Surround your VBA code with CODE tags e.g.;
[CODE]your VBA code here[/CODE]
The # button in the forum editor will apply CODE tags around your selected text.
Spot on thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks