+ Reply to Thread
Results 1 to 12 of 12

Search/Find function in excel worksheet

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

    Thumbs up Search/Find function in excel worksheet

    Hi,

    I found the following thread very useful:
    http://www.excelforum.com/excel-gene...worksheet.html


    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 in a cell?
    - To revise the code to mimic "Find Next" in the Cntl-F function?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    To install the code:
    • Right-click on the sheet tab
    • Select View Code from the pop-up context menu
    • Paste the code from below in the worksheet's code module
    • Change the Criteria cell and search range to suit



    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: Search/Find function in excel worksheet

    Hi,

    I copied the code but it does not work.

    With the prior code, I entered a value in cell A1 and pressed enter.

    With the new code, where/how do I specify the search range?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    The current search range is column B.
    With Range("B:B")

    What search range do you want?

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

    Re: Search/Find function in excel worksheet

    Hi,

    It works like a champ!

    I am not very fluent in reading (and understanding) vb code.
    With your explanation from your reply, I went in and changed the search range to column F which is what I wanted to search.

    Everything works great! Thanks.... you will save me a lot of time looking up asset tag numbers.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    You're welcome. I hoped the green comments would help explain the relevant parts of the code.

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

    Re: Search/Find function in excel worksheet

    Hi,

    I tried using the same vb code in another tab of the same spreadsheet.

    It did not work. I even changed the name of the private sub thinking excel might get confused with the same name for a private sub (even though the code on 2 different tabs).

    The code still did not work.

    I am searching through phone numbers. The column is formatted to (999) 999-9999. The actual value in the cell is 9999999999.

    Any help would be greatly appreciated.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    Chanage this.

    Please Login or Register  to view this content.
    The macro name has to be Worksheet_Change

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

    Re: Search/Find function in excel worksheet

    Hi,

    I did what you said and it still does not work. When I put in the value 682215 and press enter, the cursor just goes to the next line down.

    Here is a snippet of my data (column A is the carrier, Column B contains the phone number):

    682215 <----Search Value

    Wireless
    Carrier Current Number

    AT&T (682) 201-1481
    AT&T (682) 201-6041
    AT&T (682) 201-7207
    AT&T (682) 201-7419
    AT&T (682) 201-9901
    AT&T (682) 215-1388
    AT&T (682) 215-1643

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

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

    Re: Search/Find function in excel worksheet

    Ok. There is a sample spreadsheet uploaded.

    Thank you for your help.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,534

    Re: Search/Find function in excel worksheet

    Please Login or Register  to view this content.

+ 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. Search/Find function integrated into worksheet?
    By sjm in forum Excel General
    Replies: 16
    Last Post: 09-21-2017, 10:47 PM
  2. If function + Find Function to search for multiple values
    By HabsFan89 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2015, 12:11 PM
  3. [SOLVED] How to make the Worksheet search function look at the next worksheet if user click no
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2014, 09:10 PM
  4. [SOLVED] Search function to search if worksheet contains specified text
    By mougiasm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2013, 02:50 PM
  5. Find status using Excel search function
    By Dyzone in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-21-2012, 09:06 AM
  6. Search/Find function Excel 2000/2003
    By Blade Fisher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-01-2011, 07:53 PM
  7. FIND or SEARCH worksheet function
    By Mike Archer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2006, 12:35 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