+ Reply to Thread
Results 1 to 7 of 7

Multi Selection Listbox

Hybrid View

  1. #1
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Multi Selection Listbox

    if it's an activeX-listbox, and the listbox contains a one-dimensional array:

    sub snb()
      for j=0 to sheet1.listbox1.listcount-1
        if sheet1.listbox1.selected(j) then c01 =c01 & "|" sheet1.listbox1.list(j)
      next
     
      if c01<>"" then 
        sn=split(mid(c01,2),"|")
        sheet2.cells(rows.count,1).end(xlup).offset(1).resize(ubound(sn)+1)=application.transpose(sn)
      end if
    End Sub



  2. #2
    Registered User
    Join Date
    08-12-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Multi Selection Listbox

    @Snb
    This code is giving some error, its saying Syntax error
    This is the code :

    Dim j As Long
     For j = 0 To Sheet1.ListBox1.ListCount - 1
        If Sheet3.lstSpecialization.Selected(j) Then
            c01 = c01 & "|" Sheet3.lstSpecialization.List (j)
      Next
      If c01 <> "" Then
        sn = Split(Mid(c01, 2), "|")
        Sheet2.Cells(rows.Count, 1).End(xlUp).Offset(1).Resize(UBound(sn) + 1) = Application.Transpose(sn)
      End If
    Last edited by protocol; 08-18-2011 at 03:39 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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