1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Find/Replace MS Word Macro

Discussion in 'Business Applications' started by ns81, Apr 3, 2008.

Thread Status:
Not open for further replies.
  1. ns81

    ns81 Thread Starter

    Jul 11, 2007
    I have written a macro in MS Word that basically checks items off a list. It is based off of the seach and replace function, all it does is serach for a term and when it finds it changes it's color to blue and makes it strikethrough. I don't know if this is the most efficient way of doing it but this is the way I've come up with.

    What I would like to add to it is the ability to have it tell me when the term is not found in the list, and possibly add it to the bottom of the list in a red color or something. Anyone know how I could do that?

    Here is the macro code:

    Sub CrossOff()

    For x = 1 To 5 'Find and replace 5 times

    SearchTerm = InputBox("Word to search")


    With Selection.Find
    .Text = SearchTerm 'Word to search for
    .Replacement.Text = SearchTerm 'Replace with same word, different

    End With


    With Selection.Find.Replacement
    .Text = SearchTerm
    .Font.Color = wdColorBlue 'change the text to blue
    .Font.StrikeThrough = True 'cross it out
    End With

    Selection.Find.Execute Replace:=wdReplaceAll

    Next x

    End Sub
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/699974

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice