+ Reply to Thread
Results 1 to 5 of 5

Populate textboxes from listbox.click

  1. #1
    Registered User
    Join Date
    05-03-2012
    Location
    South London
    MS-Off Ver
    Excel 2010
    Posts
    10

    Populate textboxes from listbox.click

    Hi guys

    I have been trying to populate a listbox using option buttons then click on the listbox to do a vlookup and populate 4 textboxes. When I open the userform and click on any of the option buttons the listbox populates correctly and so do the textboxes when I click on the listbox item, however when I click on another option button I get an error. First thought was to clear the listbox but this also creates an error.

    The option buttons represent 11 different worksheets and the listbox are names taken from those sheets, then use the name to populate the textboxes with info from vlookup.

    Please Login or Register  to view this content.
    Hope you can understand where Im going with this and any help would be appreciated.

    wingnut74

    Moderator's note: I have added code tags because it's your first post. Please take the time to review our rules. There aren't many, and they are all important. --6StringJazzer
    Last edited by 6StringJazzer; 12-30-2013 at 02:02 PM. Reason: code tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Populate textboxes from listbox.click

    What error do you get and where do you get it?

    PS Can you add code tags?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-03-2012
    Location
    South London
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Populate textboxes from listbox.click

    When I open the userform and select a option button the list box populates, then I select a name from the list and the text boxes populate, all works well. When I select a different option button the error is "Runtime error 214746259(8000-4005)Unspecified error" and debug highlights frmAnnualLeave.lstNames.Clear. There are 11 different worksheets where the names for the listbox are, then a vlookup on the name to get textbox data. I can attach the worksheets if required...

    Thanks

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Populate textboxes from listbox.click

    The problem is caused by using RowSource to populate the listbox.

    Either use RowSource = "" to clear the listbox, or don't use RowSource use List.
    Please Login or Register  to view this content.
    If you are going to use List, make sure you clear RowSource in design view, or in the form's Initialize event.

  5. #5
    Registered User
    Join Date
    05-03-2012
    Location
    South London
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Populate textboxes from listbox.click

    Now works fine....

    Thanks for your help and sorry about the tags, will remember next time.

    wingnut74

+ 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 textboxes from listbox item cellrow to modifie cellvalue and send it back to exce
    By prohmex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2013, 06:43 PM
  2. Userform populate listbox with search from multiple textboxes
    By chendysworld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2012, 11:12 AM
  3. [SOLVED] Populate listbox columns with entries from textboxes on userform
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2012, 11:05 PM
  4. 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
  5. Prevent ListBox Click Event Until Mouse Click
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2011, 12:23 PM

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