Written by Allen Wyatt (last updated September 5, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
When Peter wants to find a word at the end of a paragraph, he searches for XXX^p and replaces it with YYY^p. This doesn't, however, find words at the very end of table cells. He wonders how he can search and replace the words at the end of table cells and if there is a special code similar to ^p.
There is no special code similar to ^p (end of paragraph) to indicate the end of a cell. There is a trick you can try, however, that works well for many people.
First, create a unique paragraph style that you will use only for the contents of the cells in your table. Make sure you apply this style to all of the cells within the table. Next, use Find and Replace to search for the style. In the Replace With box, enter the code ^& followed by what you want to add to the end of the cell. Then, step through all occurrences and do your replacements, as desired. The ^& code specifies that you want to replace what you found (the text in the cells formatted with the unique style) with what you actually found.
If you want to replace a specific word in the table cells (XXX) with something new (YYY), you can follow the same steps as above, simply search for any occurrences of XXX using the unique table-cell style and replace it with YYY. You'll still want to step through the matches and determine if the replacement should be made on a case-by-case basis, but you will be able to make the changes in your table much quicker.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13571) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When laying out a page, you often need to move objects around to get them into just the right position. Word allows you ...
Discover MoreWant to get rid of information within a table, but not the table itself? Here's a guide to understanding the effects that ...
Discover MoreTables, in Word, can either be inline with the rest of your text or the text can wrap around the table. If you have ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-03-14 10:35:17
Andrew
Krasimir,
Just a thought: Sometimes in situations such as this it may be easier to blow out (delete) all of the problematical characters (in your case the "г") and then reinsert them where necessary using find and replace or a macro.
Another trick is to use a sequence of find and replace operations starting with, for example, replacing all "г " with "г^pX#$%" - i.e., the "г" followed by "semaphore" text beginning with the ^p followed by some other text will not appear anywhere else in the document. Then run your macro knowing that all occurrence of "г" will have a paragraph marker after it. Finally, delete the semaphore text "^pX#$%" you previously added with a find and replace operation.
Andy.
2022-03-12 16:47:09
Krasimir Paskulov
Hello,
Thank you very much for this useful idea.
I've been trying to solve a similar problem for quite a while now, and I still haven't manage to find a solution.
It think it goes the opposite way, but I'm not the wise one here, so I'm asking you if this trick could be used to solve my problem.
Here's my case:
I'm from Bulgaria, and for some strange reason, there's a habit of putting г. (abbreviation for year) at the end of dates. I'm a translator and it hampers my work immensely. So I scratched my head for a solution to this nasty г. and here's what I fixed up:
First remove all useless multiple spaces (^w -> one space), and replace all г. ^p with г.^p
Then turn on Use wildcards and go through 3 steps, to remove all variants of г. in all possible positions.
Step 1:
([0-9])г. ([!А-Я])
([0-9]) г. ([!А-Я])
([0-9]) г.([!А-Я ^13])
\1 \2
Step 2:
([0-9])г. ([А-Я])
([0-9]) г. ([А-Я])
([0-9]) г.([А-Я])
\1. \2
([0-9])г.(^13)
([0-9]) г.(^13)
\1.\2
And I thought I'd made it, only I found out г. remained intact at the end of lines in table cells.
So do you think there's a way for me to use the style application trick AFTER I have performed those 3 steps?
Or should I rather first select all tables, use this special style all through the table content, then look for all cases of г. in this style only, remove them, then restore the tables' normal style?
Thank you very much.
Best regards,
Krasimir Paskulov
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments