+ Reply to Thread
Results 1 to 4 of 4

Search for a value in a workbook, and return the Spreadsheet name where it was located.

  1. #1
    Registered User
    Join Date
    04-03-2015
    Location
    Limerick, Ireland
    MS-Off Ver
    2010
    Posts
    31

    Search for a value in a workbook, and return the Spreadsheet name where it was located.

    Hi guys, I am having difficulty with a function for a program I am building. Some background to the program - It has one workbook, with multiple spreadsheets (These are hidden from the user). The spreadsheets are named after each department, e.g "Production Office", "QA Office", "QP Office". In each of these spreadsheets there are 2 columns of data: 'Batch Number', 'Reviewer'.

    What I want to do:
    A search function, where on the appropriate userform, the user will enter the Batch Number they are searching for, e.g "1E2345" and click the search button. The program should search for the number throughout the multiple spreadsheets in the workbook, and return the name of the SPREADSHEET where it was found and return the name of the Reviewer (which will be the cell directly to the right of the cell that was found in the search).

    At the moment all I can do is find the cell I am searching for, but can't return the Speadsheet name and Reviewer name.

    My original intention was to return the Spreadsheet name and Reviewer name in two separate Text boxes on the Userform. But if this is too difficult to achieve I would be happy to return the search details in a Message box.

    Many thanks in advance to anyone who has a look at my problem.

  2. #2
    Registered User
    Join Date
    04-03-2015
    Location
    Limerick, Ireland
    MS-Off Ver
    2010
    Posts
    31

    Re: Search for a value in a workbook, and return the Spreadsheet name where it was located

    An example of what the userform looks like :

    br search for forum.PNG

  3. #3
    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: Search for a value in a workbook, and return the Spreadsheet name where it was located

    Hello Quillie19,

    Here is some code that should help. It would be copied into the "General" section (very top) of the UserForm.
    Please Login or Register  to view this content.
    EDIT: You will need to change the names of the TextBoxes to what you have named them.
    Last edited by Leith Ross; 04-03-2015 at 06:42 PM.
    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!)

  4. #4
    Registered User
    Join Date
    04-03-2015
    Location
    Limerick, Ireland
    MS-Off Ver
    2010
    Posts
    31

    Re: Search for a value in a workbook, and return the Spreadsheet name where it was located

    Hi Leith, Thanks very much that code done the trick for me. I am about to post up another query about creating an "event log" on a user form, if you wish to help.

    Thanks again!

+ 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. Vba to Return the Term located between first two Dashes
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2012, 12:32 AM
  2. Need a way to search a whole workbook and return the lowest row that contains data
    By LFDallas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2011, 05:26 PM
  3. Replies: 7
    Last Post: 07-28-2011, 10:05 AM
  4. Replies: 2
    Last Post: 02-23-2009, 12:02 AM
  5. Search in excel by date located in a cell
    By Btobin0 in forum Excel General
    Replies: 6
    Last Post: 05-27-2006, 10:25 AM

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