+ Reply to Thread
Results 1 to 16 of 16

Bulk Find and Replace in WHOLE workbook

  1. #1
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Bulk Find and Replace in WHOLE workbook

    I have some code that does what I need for the activesheet only. I tried to make it loop through the whole workbook, but it just takes longer with the same result( active worksheet only). Where am I wrong on my loop, and is there a more efficent way to accomplish this?

    I have a workbook with sheet1:A3:A containing the old values. On that same sheet B3:B contains the new values. I run the macro after activating the workbook that I wish to Find and replace on.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Bulk Find and Replace in WHOLE workbook

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    Please Login or Register  to view this content.
    That line gives me an "Object Required" Error.

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Bulk Find and Replace in WHOLE workbook

    Oops:

    Should be:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    But you refer to ActiveSheet.Cells. That needs to be WS.Cells.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    Thanks for the rep.

    Assume this is resolved now ... ?



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  7. #7
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    Yes, this is sloved. My worksheet loop wasnt actually necessary. I had all but the activesheet protected, I didnt realize Find and replace only worked on unprotected worksheets. I stripped the code down to the below.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    Quote Originally Posted by TMS View Post
    But you refer to ActiveSheet.Cells. That needs to be WS.Cells.
    Okay, i thought i had this solved, but so far i'm only able to do the activesheet. I tried ws.cells. That didnt work. I need to change that to each worksheet. Any ideas?

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    You said you didn't need a loop ... which is what John tried to fix for you. And the code you have processes the active sheet ... Because you invite the user to select the sheet to process.

    So I am confused, particularly because your thread title says "within the whole workbook".

    Suggest you clarify your requirements and post a sample workbook.

    Regards, TMS

  10. #10
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    I have attached my two sample workbooks.
    in the TestReplaceWorkbook.xlsx all four sheets contain different text strings.
    in the Find and Replace.xlsm, Column A contains the find value, Column B contains the replace value.

    Currently, I open the workbook that i want to replace values on, Press Alt+F8 and run the macro once on every sheet.

    In my real workbook, I have around 30 worksheets that this becomes cumbersome to do. Can anyone tell me how to change the reference from Activeworksheet to every sheet in the Activeworkbook?
    Attached Files Attached Files

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    I'm away from home today with no computer. If no-one else has offered a solution, bump the thread tomorrow and I'll let you have something.

    Regards, TMS

  12. #12
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Bulk Find and Replace in WHOLE workbook

    Try this modification. You still have to select the workbook, but it will run the macro on all the sheets.

    Please Login or Register  to view this content.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    Is this now resolved to your satisfaction?

    Regards, TMS

  14. #14
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    Quote Originally Posted by TMS View Post
    Is this now resolved to your satisfaction?

    Regards, TMS
    Yes, thank you for following up!

  15. #15
    Registered User
    Join Date
    02-08-2014
    Location
    Jacksonville
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Bulk Find and Replace in WHOLE workbook

    Quote Originally Posted by TMS View Post
    Is this now resolved to your satisfaction?

    Regards, TMS
    Yes, thank you for following up!

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,432

    Re: Bulk Find and Replace in WHOLE workbook

    OK, good. Thanks for marking it solved.

+ 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] Bulk find/replace
    By xlhelp97 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2014, 12:47 PM
  2. Bulk find and replace
    By thisandthat in forum Excel General
    Replies: 4
    Last Post: 02-07-2012, 09:15 PM
  3. bulk find replace.
    By tobiahjadam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2009, 02:18 AM
  4. Bulk Find and Replace
    By reddy1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-19-2009, 09:57 AM
  5. how to do Bulk find and replace in excel?
    By aemunathan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2009, 02:50 PM

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