+ Reply to Thread
Results 1 to 20 of 20

Search and display all

  1. #1
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Search and display all

    Need help I have 4 columns of information and i want to use a userform to search these four columns for a specific number then display in a message box what column(s) it found this value in

    Can anyone help me?

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Search and display all

    Hi Tiny4725,

    welcome to forum.

    See the attached file and run the macro using button.... let me know if this helps. thanks.
    Search and display column.xlsm

    regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    That helps but what i would like to do is be able to display multiple locations for instance if the value 15 is in column 1 and 2... i do have header row so i could display the value at the top of each column... basically i have programs used on on our production lines and there is a list for Line 1, Line 2, never Run, and 1st time runs. so I want to be able to search that if the program exists any of these locations it will tell me and it could be in several locations

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Search and display all

    Okay..

    Would you be able to upload your sample workbook... thanks.

    regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Here it is
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Search and display all

    Hello there,

    Attached is a sample workbook. Try it out by selecting the command button and let me know if this works for you.

    If this seems like this can work for you let me know and I will incorporate it into your workbook that you uploaded.

    Thanks!
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Yeah I do think that will work thank you

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Search and display all

    Okay attached is your original worksheet updated to include the forms.

    To try it out try 69011210 then click search, double click on an item in the list to be taken to the cell.

    Thanks!

    RVASQUEZ
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Thank you this works... but one question it will crash Excel if you seach with nothing entered, how would i put a limit on how far it searches, or could i say type End somewhere in the workbook and have it look for that when nothing is entered into the search box?

  10. #10
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Search and display all

    You can add an exit to the click after the binding of the textbox value:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Thank you this works great

  12. #12
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Search and display all

    Hello there,

    I have attached an updated workbook. This one incorporates the code from rkey above as well as tells you if there are no Results found.

    Thanks!
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Ok so i thought this was solved but i just ran into something, it can not find anything in engineering column because there is a "SMT 1" or "SMT 2" that usually follows it(i didnt have this in the file i had uploaded. so i guess i need to search for any cell containing the value, not matching.

  14. #14
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Search and display all

    Hey there can you reattach an example so I can try and find a workaround?

    Thanks!

  15. #15
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Here is the file I am currently working on
    Attached Files Attached Files

  16. #16
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Search and display all

    tiny4725,

    Attached is a modified version of your most recently posted workbook. I made several changes. First, I got rid of the 2nd userform, that was unnecessary. Here is the full code for the userform SearchForm:
    Please Login or Register  to view this content.

    Changes made to the userform:
    • Changed the naming convention for the controls
    • Removed the frame
    • Setup a proper tab order
    • Made the search button the Default so that pressing enter causes that button's code to run
    • Double-clicking a search result item will still take you to that cell and close the userform
    • The listbox is now a 2 column listbox. The first column contains the cell address, the second column contains the dislpay text of the cell
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  17. #17
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    Ok thank you everyone that does it

  18. #18
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Search and display all

    You're welcome. Out of curiosity though, why not just use Excel's built-in FindAll feature?

  19. #19
    Registered User
    Join Date
    05-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Search and display all

    well to be honest it is for the people that will be using it, hitting CTRL+F or selecting find just a little to hard for them so i figured a Big button would do

  20. #20
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Search and display all

    Okay I'm not sure if how I did it is the quickest or easiest way but try this.

    Let me know if it works!

    Thanks!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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