I have code that writes a set of names to an array; when that set of
names is complete a userform opens and the array populates a listbox.
The user double clicks on a name to select it, and the userform hides.
This process repeats numerous times.

On the first cycle if the user selects the third name in the list,
then on the next cycle the third name on the list is highlighted with
what I'll call "the pointer". How do I reset that pointer so it
appears at the top of the list, rather than at the .ListIndex of the
last selection?

On the double click event I mentioned earlier (which closes the
userform) I tried Listbox1.Clear, Listbox1.Listindex = -1,
repopulating the listbox from a null array, and a number of other
things, all to no avail.

This is causing a problem because the listbox list can be fairly long,
and when the pointer appears at the previous selection's ListIndex
value it causes the user to think the list is a different size than it
really is.

Any ideas for how to reset the pointer? If it helps my code follows-

Thanks,
Dave O

Private Sub UserForm_Activate()
  ListBox1.List = arrPropNames
  TextBox1.Text = FirstLast
End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
  Chosen = ListBox1.Value
  UserForm1.Hide
End Sub

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to