I'm a bit of a beginner at using visual basics to code. I have inserted an activex listbox into my sheet. Its is multiselect. I want the selectiong to be inserted into a single cell on a seperate sheet. I have found the code to do it and had it working on my Excel 2007 at home but i opened it at work on Excel 2010 and I get the error 'Compule error: cannot find project or library"
I can't work out what the error is. this is the code I have written:
Private Sub ListBox1_LostFocus()
Dim listItems As String, i As Long
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then listItems = listItems & .List(i) & ""
Next i
End With
If Len(listItems) > 0 Then
Sheets("English IEP").Range("C7") = Left(listItems, Len(listItems) - 1)
Else
Sheets("English IEP").Range("C7") = ""
End If
End Sub
Would anyone be able to point out where I have gone wrong.
Thanks so much
Bookmarks