+ Reply to Thread
Results 1 to 17 of 17

Search/Find function integrated into worksheet?

  1. #1
    Registered User
    Join Date
    01-19-2007
    Posts
    30

    Search/Find function integrated into worksheet?

    I want to put a box at the top of my worksheet where I can enter a part number, and find this cell within the spreadsheet; like a permanent ctrl F function.

    Any ideas how to get there?

    Many thanks

  2. #2
    Forum Contributor
    Join Date
    01-24-2007
    Location
    Southampton, UK
    Posts
    137
    One suggestion would be to make say A1 as the 'search box'. Then create code to detect when this has been completed and then search the worksheet.

    Do a right-click on the worksheet tab name, select View Code from the pop-up menu, then copy and paste the following in . . .

    Please Login or Register  to view this content.
    Substitute "$A$1" for another range address if preferred.

    You should also select A2 then use Windows, Freeze Panes so that the first row will always be visible even when the find feature goes elsewhere in the worksheet.

  3. #3
    Registered User
    Join Date
    01-19-2007
    Posts
    30

    Smile

    Fantastic!!!!

    Thanks very much, this works perfectly, you are a star!

  4. #4
    Registered User
    Join Date
    01-19-2007
    Posts
    30
    I've had a play around with this and it works really well, but I have hit a snag. A lot of my data includes company names, how can I get the search to work on part of the company name? At the moment it works if you type in the full company name but that is not how most people will want to search.

    Any ideas?

    Many thanks

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Change


    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Registered User
    Join Date
    01-19-2007
    Posts
    30
    Excellent, thanks very much!

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem

    VBA Noob

  8. #8
    Registered User
    Join Date
    04-05-2007
    Posts
    5
    Hi. I have used this within a spreasheet and it works very well. However, is there any way I can get this search feature to look within 2 columns only? I would like the search to work only in columns A & B.
    Many thanks.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Please Login or Register  to view this content.
    VBA Noob

  10. #10
    Registered User
    Join Date
    04-05-2007
    Posts
    5
    Hi, I tried your suggestion but I get a runtime error (1004) message and the search function stops working, this is the code I have at present -

    Please Login or Register  to view this content.
    As mentioned I want the search function to look only in columns A & B. Any suggestions would be much appreciated. Thanks
    Last edited by VBA Noob; 04-20-2007 at 07:29 AM.

  11. #11
    Forum Contributor
    Join Date
    01-24-2007
    Location
    Southampton, UK
    Posts
    137
    It seems this idea is popular, but the code needs to be adpated to various cicumstances. The original code I posted works fine if the search cell is within the search area, but errors occur with certain adaptations of the code.

    I've revised the original code to cater for users' own preferences, as shown below....

    Please Login or Register  to view this content.
    As before, right-click on the tab name, select View Code to get to the visual basic window then copy and paste in the above code.

    Alter the SearchCell and SearchRng (highlighted in red above) where indicated, as required.

    I've also now incorporated a new feature! If the search text has an asterisk * at the end it will search for close matches, otherwise it searches for exact matches.

    Enjoy!

  12. #12
    Registered User
    Join Date
    11-08-2012
    Location
    great yarmouth, england
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Search/Find function integrated into worksheet?

    this is awesome stumbled upon it looking for help with a macro to do almost this, any chance you can add a find next function the book im using it in has the same companys listed mor than once it works great tho especially liked the * find closest match part of it just really nead to be able to toggle to next if theres more than one of the same entry

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Search/Find function integrated into worksheet?

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    HTH
    Regards, Jeff

  14. #14
    Registered User
    Join Date
    02-06-2013
    Location
    Copenhagenm, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Search/Find function integrated into worksheet?

    Dear Loz

    This is very usefull to me.
    I would like to make the "Find box" en one sheet but searching in an other, but in the same workbook. Can you help me with the coding?

    Many thanks in advance

    Millhill






    Quote Originally Posted by sjm View Post
    I want to put a box at the top of my worksheet where I can enter a part number, and find this cell within the spreadsheet; like a permanent ctrl F function.

    Any ideas how to get there?

    Many thanks
    Quote Originally Posted by Loz View Post
    One suggestion would be to make say A1 as the 'search box'. Then create code to detect when this has been completed and then search the worksheet.

    Do a right-click on the worksheet tab name, select View Code from the pop-up menu, then copy and paste the following in . . .

    Please Login or Register  to view this content.
    Substitute "$A$1" for another range address if preferred.

    You should also select A2 then use Windows, Freeze Panes so that the first row will always be visible even when the find feature goes elsewhere in the worksheet.

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Search/Find function integrated into worksheet?

    Millhill,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  16. #16
    Registered User
    Join Date
    09-21-2017
    Location
    Fort Worth, Texas
    MS-Off Ver
    2010
    Posts
    20

    Re: Search/Find function integrated into worksheet?

    This worked perfectly as well!

    Is it possible:
    - To revise the code to search and find the string of characters entered in cell A1 instead of searching for an exact match?
    - To revise the code to do a "find next" after the first occurrence is found?

  17. #17
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Search/Find function integrated into worksheet?

    rmichra,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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