Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-05-2021, 11:03 AM
Stephen Ray Stephen Ray is offline Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? Windows 10 Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? Office 2016
Advanced Beginner
Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part?
 
Join Date: Sep 2018
Location: Kansas
Posts: 34
Stephen Ray is on a distinguished road
Default Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part?

Is it possible to highlight a phrase in a document, then find and replace something only in the highlighted part?



I would be too embarrassed to tell you the contortions I have been through to accomplish this in some macros.

It has been a slow dawning for me that there has got to be a better way.

Very often, I copy parts from four online input documents, paste them to one Word Document and let my macro combine these four inputs into many phrases which I then must paste into a couple of other new online documents.

Since I never know which exact line the inputs are on, the macro must find “Organization:” for example:

Part of the doc:
Lower Echelon: AFL of the CIO
Sub Department: CIO
Organization: AFL of the CIO From Hawaii
Top Agency: AFL of the CIO Incorporated

Then once the “Organization:” is found, the macro could easily highlight "AFL of the CIO From Hawaii" by extending from the : colon to the end of the line.

How would you replace “CIO” with “CIB” only in the highlighted part?

Lastly, all the highlighted part with the changes, "AFL of the CIB From Hawaii" need to go to the clipboard somehow. I do it this way: Selection.Copy

I know how to find and replace things in the whole document or only on the 1st line using range alright, but not a highlighted part.

Thanks,
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Kalü Word VBA 22 04-24-2018 05:35 AM
Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? Find, select, and replace part of text with bold paik1002 Word VBA 4 12-07-2015 11:24 PM
Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? Find-replace using part of what was found in the replacement text paulkaye Word 3 12-22-2014 02:52 AM
Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part? Find/Replace Wildcard Needed-Bold & Highlight rsrasc Word VBA 3 11-11-2014 03:55 PM
find - reading highlight - highlight all / highlight doesn't stick when saved bobk544 Word 3 04-15-2009 03:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft