Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSControls List Box Wierd Behaviour

Status
Not open for further replies.

PBAPaul

Programmer
Aug 3, 2002
140
GB
I have placed a listbox - called RefList - on a worksheet using the Control Toolbox. I have set the properties to single selection etc. On a click of the listbox I call the following code:

Private Sub RefList_Click()
RecNo = RefList.ListIndex + 1
Sheets("Control").Range("RecNo").Value = RecNo
ShowAddInfo
End Sub

The macro ShowAddInfo gets details of the relevant record from a list of addresses and places them on the worksheet.

The problem is that when I click on a record in the listbox, the relevant address details are shown correctly ie the RefList_Click macro operates, but the record I select is not highlighted in the listbox. If I click on the record again then the record is highlighted.

I then click another record and the macro operates, but the record is not highlighted. Click again and the record is highlighted BUT also the record that I previously highlighted is still highlighted.

I can end up with numerous highlighted records and if I click or double click on a highlighted record it does not de-select that record.

Please can anyone tell me what is going on? What have I done wrong?

Paul
 
Hi PBAPaul,
this is due to the macro RefList_Click is executed with Application.ScreenUpdating=False. After:
[tt]Private Sub RefList_Click()
Application.ScreenUpdating=True
...[/tt]
all will work normally.

combo

 
Combo

Thanks for the suggestion but it is not the answer. I had already tried that and the same thing happens.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top