Replacing and Formatting at the Same Time

Written by Allen Wyatt (last updated July 9, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


1

Patrick has a document in which there are "start" and "stop" character sequences that indicate where italics should begin and end. For instance, in the text sequence "$$$This is some text!$!" the "$$$" indicates the start of italics and the "!$!" indicates the end. Patrick wonders if there is a way he can use Find and Replace to (1) remove the character sequences and (2) format the text between those character sequences to italics.

This type of Find and Replace may sound difficult, but Word actually makes it quite easy, provided you use wildcards in your F&R operation. Follow these steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is visible.
  3. Make sure the Use Wildcards check box is selected.
  4. In the Find What box, enter "$$$(*)\!$\!" (without the quote marks).
  5. In the Replace With box, enter " \1" (again, without the quote marks). This tells Word to use, as replacement text, the first occurrence of text within parentheses in the pattern denoted in step 4.
  6. With the insertion point still in the Replace With box, press Ctrl+i. (This tells Word that you want the replacement text to be formatted as italics.)
  7. Click on Replace All.
  8. Close the Find and Replace dialog box.

That's it; only a single find-and-replace operation is needed. The "find" pattern (in step 4) indicates you want to find anything (*) surrounded by your indicated markers. Important! that the backslashes before the exclamation marks in step 4 are important, as they cause the characters to be treated as actual exclamation marks.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (3851) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Determining the Current Page Number

While your macro is processing the text in your document, you may need a way to determine the current page number where ...

Discover More

Quickly Identifying Applied AutoFilters

Apply an AutoFilter to a worksheet, and you can quickly forget exactly what that AutoFilter entailed. Here are a couple ...

Discover More

Changing Directories in a Macro

When a macro works with files, it often has to change between different directories on your disk drive. This is done ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Searching for Characters

When using pattern matching in a search, you can specify individual characters or ranges of characters you want matched ...

Discover More

Ordering Search and Replace

The wildcard searching available in Word is very powerful. Here's how you can use ordering in your search efforts to make ...

Discover More

Understanding Pattern Matching

Pattern matching is a type of searching you can do in Word that is very powerful. Despite its power, it remains rather ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven minus 2?

2022-07-18 16:28:37

Therese Grisewood

Hi Allen,

I'm one of your subscribers from Ireland. I'm hoping you can help me.

I need to create a vocabulary list from each chapter of my proposed Spanish book. How do I create this? Is there a trick I need to know?

Thanks for all your tips each Saturday. I read them and save them. I also have some of your videos. I'm working through Macros and used them in my Spanish book.

Thanks again and stay safe in the sun. Imagine we have over 85 degrees Fahrenheit in Ireland today. Unheard of high temperatures for our little country.

Therese Grisewood
tquinn38@gmail.com


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.