+ Reply to Thread
Results 1 to 13 of 13

Find Cell Containing String and list in Userform Listbox

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Find Cell Containing String and list in Userform Listbox

    Hi folks

    I'm looking for the code i would need in order to search cells C5:C800 and list the value of a cell in a userform listbox that contains certain text based on what was entered in textbox1.

    Any ideas?

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    Maybe this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    Thanks, however...

    I get a type mismatch error on:

    Please Login or Register  to view this content.
    Any thoughts?

    It seemed to work ok, but then the error kicked in

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    I don't know why 'it seemed to work ok,' and then not.
    See if changing to this helps?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    That's worked great!!

    Thanks for your help!

    TVM

  6. #6
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    Another one on this - i hope you can help...

    What if i want to populate the listbox with the information in column "C" and column "B"

    is this possible and what would be the code?

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Edit: but keep in mind that's ~1600 loops for every single key entered. You might want to use a command button to "activate" the search.

  8. #8
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    unfortunately that didnt work...

    I changed the listbox properties to column count of 2 but still nothing?

    TVM

  9. #9
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    Hmm did I misunderstand your question? You initially wanted to search in column C, now you want to search both columns B and C is that right?

    Or did you just want to search column C, but for that matched record you want to display information from column B and C?

  10. #10
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    Oh sorry, didnt explain it very well!

    I only want to search in Column "C" but display information from Column "B" & "C" - as what you said last.

    TVM

  11. #11
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    Ok, keep the column count at 2, try this:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-10-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Find Cell Containing String and list in Userform Listbox

    thats working brilliantly, thanks.

    One last thing - is there anyway of swapping the listbox columns around...

    currently the information is reading "C" then "B" in the listbox, but i'm after it displaying "B" then "C"

    picky I know! sorry

  13. #13
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find Cell Containing String and list in Userform Listbox

    Change to:
    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. [SOLVED] userform Multi select listbox - add contents to list
    By tbar05 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-25-2013, 10:25 PM
  2. userform listbox
    By tsiguy96 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-14-2013, 11:09 PM
  3. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  4. Populate listbox in userform based on string
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-03-2012, 12:48 PM
  5. Userform find name in listBox
    By bstubbs in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2012, 10:15 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