Results 1 to 6 of 6

Listbox multiselect- VBA code error

Threaded View

  1. #1
    Registered User
    Join Date
    10-06-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    3

    Listbox multiselect- VBA code error

    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
    Last edited by sassy1978; 10-08-2013 at 07:21 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  2. How to adapt this listbox code when multiselect is enabled?
    By Kimberley in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-02-2011, 02:00 PM
  3. Listbox (MultiSelect)
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2008, 11:58 PM
  4. [SOLVED] Multiselect Listbox use
    By RKS in forum Excel General
    Replies: 1
    Last Post: 05-12-2006, 10:10 AM
  5. [SOLVED] Bug in multiselect listbox?
    By Jos Vens in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1