+ Reply to Thread
Results 1 to 4 of 4

Extracting mulitple selections from a multi column listbox

  1. #1
    Registered User
    Join Date
    04-01-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    18

    Extracting mulitple selections from a multi column listbox

    I have a multi selection listbox that has 6 columns located on the "Form" worksheet. Trying to extract the data from the selected lines (and all columns for the selected line) and copy to another worksheet (ExtractedData). My code so far only works to extract the multiple selections for the first column. Not sure how to have it include all columns. Ideally would like to have the six columns to be extracted and placed in separate cells on the ExtractedData worksheet. Here is what I have so far:

    Sheets("Form").Select
    SelCnt = 0
    With Worksheets("Form").ListBox3
    For i = 0 To .ListCount - 1
    If .Selected(i) Then
    SelCnt = SelCnt + 1
    ReDim Preserve UserSels(1 To SelCnt)
    UserSels(SelCnt) = .List(i)
    End If
    Next i
    End With

    If SelCnt > 0 Then
    Worksheets("ExtractedData").Range(A2).Resize(UBound(UserSels)).Value = Application.Transpose(UserSels)
    End If

    Appreciate any assistance!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Extracting mulitple selections from a multi column listbox

    Hi and welcome to the forum.

    Try this...

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 04-01-2014 at 12:07 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Extracting mulitple selections from a multi column listbox

    Here is how I did it. Change the ranges, listbox object, and such as needed. Notice that I cleared the range it might be inserted to each time as that can be an issue. I just used a 10,3 (row,column) for the list range.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-01-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Extracting mulitple selections from a multi column listbox

    Awesome, thank you so much!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VB for multi column listbox
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 13
    Last Post: 01-16-2014, 03:39 AM
  2. Multi column listbox...
    By mvk1979 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2013, 06:36 AM
  3. [SOLVED] Multi column listbox
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-01-2013, 05:12 PM
  4. How to use multi-column ListBox?
    By Treacle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2010, 05:18 AM
  5. Multi Column ListBox
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-12-2010, 02:39 PM

Tags for this Thread

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