+ Reply to Thread
Results 1 to 9 of 9

Form items chosen in Listbox to populate specific cells in spreadsheet

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    Greenfield, IN
    MS-Off Ver
    Excel 2007
    Posts
    70

    Form items chosen in Listbox to populate specific cells in spreadsheet

    I know this is basic, but after three hours of trying, I am raising the white flag!! (The problem code is in RED)

    I have a form which contains textbox info and listbox information.
    My spreadsheet goes from A-AZ.
    I have five items in the listbox and I need them to be assigned to the following columns (e-i). In other words, if someone chooses the first in the list, it should be placed in column e. If they choose the second, it should be placed in column f.

    Below is the code and I am completely flummoxed.

    Any help would be appreciated.

    Please Login or Register  to view this content.
    Last edited by floydian; 08-13-2013 at 11:18 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    Hi
    I am not a VBA expert but try change the problems code lines to the following:

    ws.Cells(iRow, 5).Value = UserForm1.lbVeh.Value

    Good luck.
    Tony

  3. #3
    Registered User
    Join Date
    06-17-2013
    Location
    Greenfield, IN
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    What it is doing is putting whatever I pick in all five columns.

    I am getting the data for the list from another sheet.
    When I choose... let's say the third item down "Adobe Connect" - it then places "Adobe Connect" on all my columns E - I

    I need to figure out how to associate them in the following way, so when one is chosen, it lands in the appropriate column.

    Live Training - E
    Live Workshop - F
    Adobe Connect - G
    Conference Call - H
    Article - I

  4. #4
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    Hi
    Try this:

    With Data
    If UserForm1.lbVeh.Value = "Live Training" Then
    ws.Cells(iRow, 5) = UserForm1.lbVeh.Value
    End If
    If UserForm1.lbVeh.Value = "Live Workshop" Then
    ws.Cells(iRow, 6) = UserForm1.lbVeh.Value
    End If
    If UserForm1.lbVeh.Value = "Adobe Connect" Then
    ws.Cells(iRow, 7) = UserForm1.lbVeh.Value
    End If
    If UserForm1.lbVeh.Value = "Conference Call" Then
    ws.Cells(iRow, 8) = UserForm1.lbVeh.Value
    End If
    If UserForm1.lbVeh.Value = "Article" Then
    ws.Cells(iRow, 9) = UserForm1.lbVeh.Value
    End If
    End With

    Hope this helps.
    Good luck.
    Tony

  5. #5
    Registered User
    Join Date
    06-17-2013
    Location
    Greenfield, IN
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    HOLY GOOD GOSH... That worked!!!

    You have NO IDEA what a load off that is!!!

    I have three of these types of boxes in my form and one of them has over 30+ items (which multiple items can be selected from).
    Will this same type of code work for all of them?

    THANK YOU!!!!

  6. #6
    Registered User
    Join Date
    06-17-2013
    Location
    Greenfield, IN
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    Just found out this doesn't work when I go to "Multi-Select"
    NUTS!

    Back to the drawing board!!!

  7. #7
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    Hi
    Are you able to post a sample of your workbook so I can take a look for you.
    Tony

  8. #8
    Registered User
    Join Date
    06-17-2013
    Location
    Greenfield, IN
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    I went about it a different way and was able to get it up and running.

    Thank you so much for the help you gave me! Not only did you let me retain my sanity and look at it from a different perspective, but you also allowed me to see there were different ways I could accomplish what I was looking to do.

    I really appreciate the help!

  9. #9
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Form items chosen in Listbox to populate specific cells in spreadsheet

    Thanks for the feedback.

+ 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] Populate cells when Month is chosen in combobox for a specific name
    By SChapman in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 05-17-2013, 06:14 AM
  2. Replies: 22
    Last Post: 06-02-2012, 11:45 AM
  3. Listbox click in search won't populate previously chosen checkboxes
    By Kristengeyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2011, 04:18 PM
  4. Import specific cells from a user chosen spreadsheet
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-30-2009, 02:06 PM
  5. Populate ListBox Based On Item Chosen In Another ListBox
    By davemojo82 in forum Excel General
    Replies: 1
    Last Post: 08-04-2009, 08:39 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