Listbox order reversed

A

Amy

Hi, I am creating a listbox with names in alphabetical order. It is a
multi-pick listbox. I want to import the selected names into the Word doc. I
have this code. But the names appear in reverse alpha order in the Word doc.
What do I need to change to ensure that names appear in the Word doc in alpha
order, just like the listbox? Thanks for any help!

For i = 1 To Team.ListCount
'..and check whether each is selected
If Team.Selected(i - 1) Then
' If selected, display item in msgbox
ActiveDocument.Bookmarks("Team").Range.InsertBefore Team.List(i - 1)
& " "
End If
Next
 
J

JCNZ

Your simplest answer might be to count down, rather than up:

For i = Team.ListCount To 1 Step -1
....
....
....
Next i
 
G

Greg Maxey

Mate,

You appear to be new to these groups and a hearty welcome to you.

I am having a little difficulty grasping why you are answering a
question on the 20th of October that was asked and answered on the
12th.
 
J

JCNZ

Mate,

Well, it's quite simple, I hadn't realised that Amy had sent the same post
twice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top