+ Reply to Thread
Results 1 to 2 of 2

transfer listbox selection to different columns of worksheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    transfer listbox selection to different columns of worksheet

    hi, i have a userform for data entry. Users will populate the data in the userform and click the commandbutton1. The issue i have is with the "tables used" "time range" and "helper" listbox where users can select multiple selections. What i want to achieve is that each of the multi selection should populate in columns and not in the next row. The code i have as of now is a bit off. When i select 8:00 and 9:00 in the time range, it populates with a blank column in between. I am guessing it is also taking into account 8:30 which was not selected.

    For w = 0 To Me.ListBox3.ListCount - 1
            If Me.ListBox3.Selected(w) = True Then
            Set ws2 = Worksheets(Me.ListBox3.List(w))
            lRow2 = ws2.Cells(Rows.Count, 1) _
               .End(xlUp).Offset(1, 0).Row
        
        v = 2
        With ws2
        For x = 0 To Me.ListBox4.ListCount - 1
        For y = 0 To Me.ListBox5.ListCount - 1
            If Me.ListBox4.Selected(x) = True Then
            v = v
            If Me.ListBox5.Selected(y) = True Then
            
            If IsDate(TextBox3.Value) Then
                .Cells(lRow2, 1).Value = CDate(TextBox3.Value)
            End If
                .Cells(lRow2, v).Value = Me.ListBox4.List(x)
    '            .Cells(lRow2, 4).Value = ws1.Cells(lRow1, 1).Value
    '            .Cells(lRow2, 5).Value = Me.ListBox4.List(y)
            End If
            
            End If
            
        Next y
        v = v + 1
        Next x
        End With
        End If
        Next w
    Can anyone please help me with this? Have also attached the workbook for your reference
    Last edited by bqheng; 12-04-2018 at 07:53 PM.

  2. #2
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: transfer listbox selection to different columns of worksheet

    i solved it myself, just needed to play around with the variables position. thanks to anyone who may have tried to help

+ 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. Replies: 1
    Last Post: 05-22-2018, 08:06 PM
  2. Replies: 3
    Last Post: 10-13-2015, 02:57 PM
  3. Transfer listbox values to new worksheet
    By bodiewil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2015, 08:13 AM
  4. Transfer Data From One Userform Listbox to Another Userform Listbox with 11 columns
    By sparkoft in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2013, 10:54 AM
  5. [SOLVED] VBA: transfer values of textboxes & items from listbox to worksheet
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2013, 05:46 AM
  6. [SOLVED] Multicolumn Listbox selection transfer to cell
    By audiotunesx in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2012, 08:16 PM
  7. Replies: 2
    Last Post: 12-21-2011, 02:54 AM

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