+ Reply to Thread
Results 1 to 14 of 14

Need a macro that finds specific text in all sheets of a workbook

  1. #1
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Need a macro that finds specific text in all sheets of a workbook

    Hi,
    My problem is actually very simple. I need a macro which will find all cells containing text "date:" and then insert value of cell B3 of the first sheet in cell on the right...
    Example: cell C5 in the sheet2 contains text "date:", so in C6 should be value of cell B3 in sheet1.
    Thanks in advance!!!

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need a macro that finds specific text in all sheets of a workbook

    Hi aerodragana,

    welcome to the forum.

    Example: cell C5 in the sheet2 contains text "date:", so in C6 should be value of cell B3 in sheet1.
    would it be C6 or D5 ?


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need a macro that finds specific text in all sheets of a workbook

    Oh, my mistake!
    You are right, D5.
    Thanks a lot!!!

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need a macro that finds specific text in all sheets of a workbook

    Okay.. try using below macro:-
    Please Login or Register  to view this content.
    see attachment:- Searching a value across workbook and filling next cell.xlsm


    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need a macro that finds specific text in all sheets of a workbook

    Thanks a lot! However, what if sheets change their name? It doesn't work than

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need a macro that finds specific text in all sheets of a workbook

    I considered this.. but somewhere we need to start, so given you a code with sheet 1 as my assumption.

    Okay.. it is related with only b3 value and you can anytime revise below code:-

    b = Sheet1.Range("b3").Value

    apart from this, rest of the code is independent of the sheet name


    Regards,
    DILIPandey
    <click on below * if this helps>

  7. #7
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need a macro that finds specific text in all sheets of a workbook

    Thanks, however in my workbook doesn't work
    It highlights this row:
    b = Sheet1.Range("b3").Value

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro that finds specific text in all sheets of a workbook

    Try this one

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need a macro that finds specific text in all sheets of a workbook

    Hi guys,
    Thank you! I think it's my Office, it's in Spanish so all the functions are in Spanish...

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need a macro that finds specific text in all sheets of a workbook

    okay.. can you upload your workbook ? thx



    Regards,
    DILIPandey
    <click on below * if this helps>

  11. #11
    Registered User
    Join Date
    02-02-2013
    Location
    texas
    MS-Off Ver
    Excel 2003/2010
    Posts
    59

    Re: Need a macro that finds specific text in all sheets of a workbook

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro that finds specific text in all sheets of a workbook

    My code is based on DILIPandey's attached sheet.

  13. #13
    Registered User
    Join Date
    03-10-2013
    Location
    Hamburg
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need a macro that finds specific text in all sheets of a workbook

    Thanks to all! I have tried all your codes and they work, so I really appreciate possibility to see different approaches
    Thanks a lot!

  14. #14
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need a macro that finds specific text in all sheets of a workbook

    Great..!!

    Please mark this thread as [SOLVED].. thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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