Replace Command (Edit Menu)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Searches code in the project for the specified text and replaces it with the new text specified in the Replace dialog box.

Toolbar shortcut: tbr_repl_ZA01201735. Keyboard shortcut: CTRL+H.

Find What

Type or insert the information you want to find, or click the down arrow and select from the last four entries. If any text is selected or the cursor is on a word when you choose the command, this text is displayed in the Find What box.

Replace With

Type the text you want to use as the replacement text or paste it from the Clipboard. To delete the text in the Find What box from the document, leave the Replace With box empty.


Specifies the search range.

  • Current Procedure — Searches only the current procedure.

  • Current Module — Searches only the current module.

  • Current Project — Searches all the modules in your project.

  • Selected Text — Searches a selected range of code in your project.


Sets the direction of the search to Down, Up, or All in the selected search range.

Find Whole Word Only

Searches for the full word by itself and not as part of a larger word.

Match Case

Finds all occurrences with the exact combination of uppercase and lowercase letters specified in the Find What box.

Use Pattern Matching

Searches using pattern-matching characters.

Find Next

Finds and selects the next occurrence of the text specified in the Find What box.


Closes the dialog box without replacing text.


Confirms before replacing the search text with the replacement text.

Replace All

Replaces all occurrences of the search text with the replacement text without stopping for confirmation.