Results 1 to 4 of 4

Pull all values from UserForm List Box and Paste them to Dynamic Array in Worksheet

Threaded View

TFiske Pull all values from UserForm... 01-30-2018, 10:42 AM
Bernie Deitrick Re: Pull all values from... 01-30-2018, 12:18 PM
TFiske Re: Pull all values from... 01-30-2018, 12:45 PM
Bernie Deitrick Re: Pull all values from... 01-30-2018, 01:08 PM
  1. #1
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Pull all values from UserForm List Box and Paste them to Dynamic Array in Worksheet

    Hi all,

    Lost again.

    I have two List Boxes, LstBx_ColorsAvailable and LstBx_ColorsSelected. The user adds values from ColorsAvailable to ColorsSelected. The Add Flower button then finds the first available column and set the values in

    Row 1 = TxtBx_LatinName
    Row 2 = TxtBx_Common Name
    Rows 3 to Row n = all values in LstBx_ColorsSelected where n is the count of all values in the list box

    The first two operation for LatinName and CommonName are working but I'm lost on how to add the values from the list box to the sheet.

    Private Sub CmdBtn_AddFlower_Click()
    '
    'Source: kev_   https://www.excelforum.com/excel-programming-vba-macros/1217246-vba-code-for-updating-data-from-user-form-to-worksheet.html
    '
        Dim lc As Long
        Dim lbCount As Integer
        Dim i As Long
            
        lbCount = LstBx_ColorsSelected.ListCount
        
        With Sheets("Flowers Available")
        
        'Find next column
        lc = .Cells(1, Columns.Count).End(xlToLeft).Column + 1
        'place Latin Name and Common Name values in cells
        .Cells(1, lc).Value = TxtBx_LatinName
        .Cells(2, lc).Value = TxtBx_CommonName
        'Pull all values from TxtBx_ColorsSelected and dump them
        'to the vertical array below (2, lc)
        Dim i
        For i = 0 To LstBx_ColorsSelected.ListCount
            LstBx_ColorsSelected.Selected(i) = ChkAll
            Next i
            
        'Clear text boxes
        TxtBx_LatinName.Text = ""
        TxtBx_CommonName.Text = ""
        TxtBx_LatinName.SetFocus
    
    End Sub
    My initial post for this project can be found at:
    HTML Code: 
    Thank you for the help.
    Last edited by TFiske; 01-30-2018 at 10:55 AM. Reason: Added link to initial post per forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 11-07-2016, 07:49 AM
  2. [SOLVED] listing array values in a dynamic list based on 2 criteria from ranges
    By lkeltner in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-14-2016, 01:45 PM
  3. VB UserForm ComboBox List Based On Dynamic Named Range in Worksheet
    By huntethic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2015, 02:45 PM
  4. Getting values from dynamic textboxes on userform in array
    By nasdrasil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2014, 03:53 PM
  5. Paste Values from Userform into Worksheet
    By mrmoc85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 02:47 AM
  6. Selecting two dynamic ranges and paste values only combining into one list
    By jbellows in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-27-2012, 05:36 PM
  7. paste values from named dynamic range to another worksheet
    By Nate H in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2006, 02:50 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