+ Reply to Thread
Results 1 to 8 of 8

VBA code to loop through a table & show only rows that contain search results

  1. #1
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    VBA code to loop through a table & show only rows that contain search results

    Hi all!
    I almost know nothing about coding or VBA/I found that the hard way! hahaha!. Therefore, any help/idea will be super appreciated!
    in cell "b1", the user will insert a string as a search inquiry. the purpose of that is to search a table ("gloss." located in the same sheet) for all cells that their values equal "*"&b1&"*" then only show the rows that contain those cells while hiding the other rows. also, when "b1" is empty, all rows in table "gloss." should be unhidden. I know that there should be a loop involved in the code. However, I could not produce any working code so far. I am starting to think, am I too rookie or that is indeed so hard in excel?!

    Thanks a lot for all your thoughts & ideas & willingness to help!
    Attached Files Attached Files
    Last edited by blue_clouds_mountain; 09-14-2021 at 06:03 AM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,300

    Re: VBA code to loop through a table & show only rows that contain search results

    And drumroll...Sample file?
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: VBA code to loop through a table & show only rows that contain search results

    yes! sure!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,300

    Re: VBA code to loop through a table & show only rows that contain search results

    There we go...Now for a explanation and example...
    You say cell B1...Where...And give an example of string entry and where one would need to find this entry...Which column...More than one column?

  5. #5
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: VBA code to loop through a table & show only rows that contain search results

    yes! I see. the user is supposed to enter the search term in b1/search term like "CD8" for example. the search should be run in all columns. whenever there is a match, the rows of matching cells only should be shown.
    Thanks a lot for trying to help. and sorry for not making myself clearer earlier. I have reuploaded a sample data file.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,300

    Re: VBA code to loop through a table & show only rows that contain search results

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

  7. #7
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: VBA code to loop through a table & show only rows that contain search results

    that is great again! thank you sooooooooooooo much!

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,300

    Re: VBA code to loop through a table & show only rows that contain search results

    Glad I could contribute...tx for rep +

+ 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] Count rows and show results in pivot table
    By jaryszek in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 04-26-2021, 05:49 AM
  2. Search Table and show multiple results
    By jakeh2475 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-12-2017, 06:26 PM
  3. Help Modifying Some Code - Search Results Displayed as Table in Listbox
    By ajiljay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2017, 09:05 AM
  4. Search Multiple Columns and Rows - Show results in Multiple columns and rows
    By heykeighley in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 08-12-2015, 10:16 AM
  5. [SOLVED] Loop search with results in a new column
    By vsevolod in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-11-2015, 03:45 PM
  6. Search given value in row(and show all results)
    By SeRoMaRu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-07-2014, 07:29 AM
  7. Loop a code using the values of various columns and rows within a table
    By TommyToe in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-17-2012, 06:01 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