Replacing items

User avatar
silverback
5StarLounger
Posts: 780
Joined: 29 Jan 2010, 13:30

Replacing items

Post by silverback »

I want to replace a specified item with '2nd' throughout the document.
I'm using Ctrl + H but try as I might, I can't get it to insert the superscript 'nd'; it just inserts 2nd, like this.
Can I force it to insert superscript, please?
Silverback

User avatar
StuartR
Administrator
Posts: 12629
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Replacing items

Post by StuartR »

I can get it to format the entire string as superscript, by using the Format ... Font ... option in the replace dialog. I don't think you can apply formatting to just some characters in the replacement string without using VBA to do the replacements.
StuartR


User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Replacing items

Post by HansV »

Stuart is correct (of course)
Best wishes,
Hans

User avatar
silverback
5StarLounger
Posts: 780
Joined: 29 Jan 2010, 13:30

Re: Replacing items

Post by silverback »

Thanks, people.
Silverback :thankyou:

User avatar
Rebel
4StarLounger
Posts: 568
Joined: 24 Jan 2010, 16:02
Location: Recently moved to Bracebridge - in the heart of Muskoka.

Re: Replacing items

Post by Rebel »

I'm using an older version of Word, but in the AutoCorrect options, one of the options is to replace "ordinals (1st) with superscript". If this option was set, then you wouldn't have to replace anything - it's replaced as you type. Would this help?
Edited to add: On second thought, this would have to be done while typing the original document.
John :canada:
A Child's Mind, Once Stretched by Imagination...
Never Regains Its Original Dimensions

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Replacing items

Post by HansV »

You can add the AutoFormat or AutoFormat Now button to the Quick Access Toolbar (the command can be found in the Commands Not in the Ribbon category). Clicking the button will apply all AutoFormat rules to the document. That might, of course, do more than you want.
Best wishes,
Hans

User avatar
Jay Freedman
Microsoft MVP
Posts: 1320
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Replacing items

Post by Jay Freedman »

The simplest method is to type the 2nd in the document and copy or cut it to the clipboard. Then enter the expression ^c in the Replace With box of the Replace dialog; that's the code for "clipboard contents". This works for a number of difficult replacements, such as inserting an entire field, or any text that contains two or more different formats.

User avatar
silverback
5StarLounger
Posts: 780
Joined: 29 Jan 2010, 13:30

Re: Replacing items

Post by silverback »

Wow. Jay, that is SO useful. Works perfectly, of course.
I am sure lots of loungers will find that very helpful
I am VERY grateful. :thankyou:
Silverback

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15651
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Replacing items

Post by ChrisGreaves »

Jay Freedman wrote:
03 May 2024, 23:10
... Then enter the expression ^c in the Replace With box of the Replace dialog; that's the code for "clipboard contents". ...
:clapping: :clapping: :clapping:
He who plants a seed, plants life.

User avatar
StuartR
Administrator
Posts: 12629
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Replacing items

Post by StuartR »

That's a new one for me. Thank you
StuartR


User avatar
Rebel
4StarLounger
Posts: 568
Joined: 24 Jan 2010, 16:02
Location: Recently moved to Bracebridge - in the heart of Muskoka.

Re: Replacing items

Post by Rebel »

Excellent! Thanks Jay.
John :canada:
A Child's Mind, Once Stretched by Imagination...
Never Regains Its Original Dimensions

User avatar
Jay Freedman
Microsoft MVP
Posts: 1320
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Replacing items

Post by Jay Freedman »

The ^c isn't the only useful code that's hard to find in documentation. There's a nice table of them in https://www.gmayor.com/replace_using_wildcards.htm under the heading "Control Codes that may be used with the search/replace tool". Despite the article title that mentions wildcards, many of these codes work in non-wildcard replacements.