+ Reply to Thread
Results 1 to 12 of 12

Search to populate listbox (Stuck at blank cells)

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Search to populate listbox (Stuck at blank cells)

    Hi Guys

    VBA code to search for all occurrences of same item and populate listbox on a userform with certain data, (see attached file), works well accept it will not skip over blank cells and continue its search, it is actually coded to stop at the first blank cell, I have tried to modify it but have failed, this is not my code but work inherited, any help would be welcome.


    Regards
    John
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Search to populate listbox (Stuck at blank cells)

    Try this....

    Please Login or Register  to view this content.
    Last edited by meabrams; 05-08-2017 at 02:16 AM. Reason: Wrong call for Worksheet fixed now
    Bramz

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Search to populate listbox (Stuck at blank cells)

    change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: Search to populate listbox (Stuck at blank cells)

    Getting a Type mismatch error highlighting line.....
    Set xsht = Sheets("Library")

    Thanks for the help

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Search to populate listbox (Stuck at blank cells)

    ps this method you have going only picks up EXACT matches

    Please Login or Register  to view this content.
    This part of the code seems to be abandoned (possibly from other attempts to apply internet code)
    should be noted that this is how you would setup to search for partial text and into other columns (Should you require it as well)

  6. #6
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: Search to populate listbox (Stuck at blank cells)

    Yeah the problems of inheriting other peoples work perhaps I need to go down a different path

  7. #7
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Search to populate listbox (Stuck at blank cells)

    Working reversion of your original file

  8. #8
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: Search to populate listbox (Stuck at blank cells)

    That seems to be working, thank you very much, can I ask what were the changes you made?

  9. #9
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Search to populate listbox (Stuck at blank cells)

    I made an error that I didn't catch in my original post

    Please Login or Register  to view this content.
    needed to be

    Please Login or Register  to view this content.
    I fixed it in the post but I am guessing that you copied it from before I fixed my error

  10. #10
    Registered User
    Join Date
    10-05-2012
    Location
    Gainsborough, England
    MS-Off Ver
    Office 2016 & Office 365
    Posts
    87

    Re: Search to populate listbox (Stuck at blank cells)

    Thank you for your help

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Search to populate listbox (Stuck at blank cells)

    Using the other method you had at start of code instead
    ie Range.Find method

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,539

    Re: Search to populate listbox (Stuck at blank cells)

    No loop
    Please Login or Register  to view this content.

+ 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. Stuck on a few things, Sorting and search/ populate.
    By Hawk223 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-27-2015, 12:33 PM
  2. Populate listbox if search reference is duplicated
    By rayexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2014, 07:55 AM
  3. [SOLVED] ListBox to populate UserForm trouble with same search criteria
    By chriswhite1982 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-10-2014, 01:46 AM
  4. [SOLVED] Item in ListBox (search) to populate UserForm with values
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-12-2013, 04:47 AM
  5. [SOLVED] Populate a Listbox in a UserForm based on a Search Result
    By clapforthewolfman in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 07-17-2013, 07:53 PM
  6. Populate a Userform from a selection on a popup search listbox
    By ahmadassaad in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 10-16-2012, 09:00 AM
  7. 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

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