+ Reply to Thread
Results 1 to 4 of 4

Find and replace all macro

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Find and replace all macro

    Hi there, Can someone give me the coding to find all words (for example apple) and repalce with "apples" in a worksheet of over 18,000 columns?

    I know how to do this as a one off using ctrl + f, but need it in macro format

    (recording a macro and then running the ctrl f part didn't seem to capture what i need).

  2. #2
    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
    44,565

    Re: Find and replace all macro

    Are there other words in the cell? Or do you want to match the whole cell content?

    Recording a macro and tidying it up a little for readability gives:

    Please Login or Register  to view this content.

    But, if you can't match whole cells, you need to take into account that you might already have "apples" or, possibly, "applecake" ... or whatever.


    Regards
    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


  3. #3
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Find and replace all macro

    Hi, I may have actually not given the full story.

    i first need to apply a filter using the header rows. So any item in column K that is "yes" and that has apple in column C or D needs to be changed from apple to apples.

    That means any items in column C or D that have NO in column K stay as apple and aren't changed.

    The match is excat - apple to apples

  4. #4
    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
    44,565

    Re: Find and replace all macro

    After you filter on column K, use:

    Please Login or Register  to view this content.

    Regards

+ 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