+ Reply to Thread
Results 1 to 12 of 12

Search many workbooks for specific text, then insert a text in adjacent cell

  1. #1
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Search many workbooks for specific text, then insert a text in adjacent cell

    I have a folder which contains many more folders each containing many workbooks with multiple sheets.

    I am trying to find a way to search through all of the workbooks for any cells that contain the text "Signed By" in them and when found, place text (a name) in the cell to the right of it.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    Try code like this - select all the files you want to process when the file open dialog appears.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    This is working very well to put in the signature, however, the message box stating there were already filled in signatures pops up for all sheets although there are not any filled signatures prior to running the code

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    In my testing, it did not, and there may be something you're overlooking. But, if you're happy without that warning, just take out that line.

  5. #5
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    Thank you very much. How would I adjust to put in a signature even if that cell already contains text? For example, I were to make a typo in the signature and needed to correct for it or if the name needs to be changed to a different person?

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    This will change to a new value or fill in a blank:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 05-25-2017 at 03:41 PM.

  7. #7
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    This is working very well! I do have another question. Is there a way to create a condition that checks the header of the sheet for a specific text that will set the signature?

    For example, if header contains "Dept 1" signature is "John Hancock, if header contains "Dept 2" signature is "Sally Sanders" etc etc

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    Sure - this assumes that the headers are unique:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    So if there are 15 sheets in the workbook but only 3 unique headers this will not work?

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    No - you can have as many sheets as you want with any header, but if you have two headers on a single sheet, the second header is the one that will be used.

    For example, if only

    Dept 1

    is found, then the first signature will be used, but if you have


    Dept 1
    Dept 2

    then Dept 2's signature will be used on that sheet.

  11. #11
    Registered User
    Join Date
    04-04-2016
    Location
    Ohio, USA
    MS-Off Ver
    2010
    Posts
    26

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    I am having a problem with this where the last signature is always used. In this case I am always ending up with the signature "Tessie Tester" even though Dept 1 or Dept 2 is the text in the header

  12. #12
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Search many workbooks for specific text, then insert a text in adjacent cell

    If that is happening, then you are not finding a department that you have coded on those sheets, and the code is using the previous sheet's values. This version will only sign if it finds a department correctly

    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. [SOLVED] If a cell contains text insert specific text in specific cells in row
    By muss1210 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2017, 10:51 AM
  2. [SOLVED] Search for a text string and return given text string to adjacent cell
    By hecgroups in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2015, 04:50 AM
  3. Search for a text string and return adjacent cell value for each match
    By ral8088 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-21-2013, 09:55 AM
  4. Formula to identify part of a text in cell from range of cells & insert adjacent cell text
    By Novicebutnotforlong in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-19-2013, 02:11 AM
  5. [SOLVED] To search specific text in a cell that contains text string
    By mikail in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 03:02 PM
  6. Replies: 3
    Last Post: 06-17-2013, 01:09 PM
  7. [SOLVED] Find Specific Text in Text String and Return Value in Adjacent Column
    By watchouse in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 03:53 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