listbox

S

sal

Hi a have list box with this code in it.
Private Sub ListBox1_Click()
ActiveCell.Value = ListBox1.Value
strStartDir = ThisWorkbook.Path
GraphicFile = strStartDir & "\150\" & ActiveCell.Value & "a.jpg"
Image1.Picture = LoadPicture(GraphicFile)

ActiveCell.Value = ListBox1.Value
strStartDir = ThisWorkbook.Path
GraphicFile = strStartDir & "\150\" & ActiveCell.Value & "b.jpg"
Image2.Picture = LoadPicture(GraphicFile)
End Sub

everything works fine except when in the list box, if two items get
clicked on or highlighted at the same time by accident then I get a
runtime error 53. How can I force only one item to be selected. I have
multiselect set to single from the list box options.
 

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