+ Reply to Thread
Results 1 to 5 of 5

Highlight matching string in Listbox based on Textbox value

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Highlight matching string in Listbox based on Textbox value

    I thought I would get this on my own, but I digress.
    I received sample code to populate a listbox from tab names of a workbook, yay!
    What I have attempted is to use a user form, enter a string in a textbox and if it match's any string in the list box, then highlight.

    Basically, its a simple search engine.

    Any hints, tips or examples are appreciated.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Highlight matching string in Listbox based on Textbox value

    I think you'll need to have the list box multiselect, and loop through to find the listindex of the matching values, and then select them.

    Never done this before.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Re: Highlight matching string in Listbox based on Textbox value

    I dont think I will need multi select, there will not be duplicate tab names.
    My trouble starts with trying to go though the list index to find the match.

    This is all I have now.
    Please Login or Register  to view this content.
    I dont think SetFocus is what I think it is for.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Highlight matching string in Listbox based on Textbox value

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  5. #5
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Re: Highlight matching string in Listbox based on Textbox value

    Just found out, the listbox is case sensitive...

+ 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] VBA userform search for listbox entry based on Textbox value
    By Hilton1982 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-12-2015, 08:29 AM
  2. [SOLVED] Filter Listbox Values based on Textbox input
    By redocs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 04:59 AM
  3. VBA listbox based on value in textbox
    By excelvraag in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2012, 11:11 AM
  4. Highlight matching parts of a string
    By ianh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-22-2010, 11:20 AM
  5. update data based on listbox & textbox
    By SarahPintal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2010, 02:37 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