I'm very close to getting my script to work the way I want it to. I always get a little confused when using the Do While and Loop elements.

I have a UserForm that has a ListBox that populates values pulled from the RowSource property. Also, I've set the MultiSelect value to "fmMultiSelectExtended" so that any configuraiton of multiple values can be selected in the ListBox. I want my script to go through each value, run some code for each selected, and then stop once each value has been used.

Here's what I have so far:

Code:
Dim I As Long
Dim J As Long
Dim ListValue As String
Dim Listbox1Variables() As String

    ReDim Listbox1Variables(0 To ListBox1.ColumnCount - 1)
    For J = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(J) Then

            For I = 0 To ListBox1.ColumnCount - 1
                Listbox1Variables(I) = ListBox1.Column(I, J)
            Next I
            ListValue = Join(Listbox1Variables, ",")
        End If

'The list box contains titles and names together, this removes the title and returns the name.  I then use the 'RealName' variable in my code.
Dim RealName As String
RealName = Right(ListValue, Len(ListValue) - InStrRev(ListValue, "- ") - 1)

''''run some code here, using the RealName variable'''

Next J
Right now, it's not moving to the next ListBox value. It only does the first ListBox value, and does an infinite loop for the first value. I have to use CTRL+Break to stop the code. I'm not sure where to adjust the code. Thanks for any help!