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
Private Sub RefList_Click()
RecNo = RefList.ListIndex + 1
Sheets("Control"
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