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
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
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 . . .
Substitute "$A$1" for another range address if preferred.Please Login or Register to view this content.
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.
Fantastic!!!!
Thanks very much, this works perfectly, you are a star!
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
Hi,
Change
toPlease Login or Register to view this content.
VBA NoobPlease Login or Register to view this content.
_________________________________________
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 !!!
Excellent, thanks very much!
No problem
VBA Noob
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.
Try
VBA NoobPlease Login or Register to view this content.
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 -
As mentioned I want the search function to look only in columns A & B. Any suggestions would be much appreciated. ThanksPlease Login or Register to view this content.
Last edited by VBA Noob; 04-20-2007 at 07:29 AM.
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....
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.Please Login or Register to view this content.
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!
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
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
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]
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?
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks