+ Reply to Thread
Results 1 to 5 of 5

Function to search for string across multiple sheets

  1. #1
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Function to search for string across multiple sheets

    This is the first time I have ever tried to write my own function, and I'm not sure what I am doing wrong, but this is not working. I am trying to get a function to search for a value across multiple sheets, and if it finds a match then return the name of the sheet that the value was found on. Here is what I have so far:

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function to search for string across multiple sheets

    Hello chaddug,

    This version of your macro will return the sheet name where the first occurrence of the text is found. If not then it returns an empty string.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: Function to search for string across multiple sheets

    Thanks for the reply, but it is actually not working. I choose to have it search for the first string of text on the first worksheet, and it just returned a blank value. Also, I'm not sure if your code does this already, but it needs to not search the sheet that the function is used on, because the search string will be on that sheet as well as possibly one of the others.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Function to search for string across multiple sheets

    Hello chaddug,

    I know the code works because I tested it for posting. The problem maybe that you are not calling the macro correctly. The macro can be called by another VBA macro or used on the worksheet as a function (UDF).

    If you post your workbook it will be easier to resolve the issue.

  5. #5
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: Function to search for string across multiple sheets

    I figured out why it was not working, it was looking in column A for the match and it should be looking in column C. Thanks for your help!

+ 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 Function with multiple sheets
    By scotsman88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2014, 11:22 AM
  2. Search function across multiple work sheets
    By evgn12 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-24-2014, 11:46 AM
  3. Search for a string in multiple excel files with multiple sheets
    By ghermanu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2012, 05:46 PM
  4. Search string from multiple sheets
    By venkatkumar1111 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2012, 03:40 AM
  5. Search for Multiple String Values on Multiple Sheets and Copy Rows to New Sheet
    By rrtikker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2012, 12:21 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