Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2020, 06:33 PM
Peterson Peterson is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Competent Performer
Remove paragraph marks in Excel from Word-sourced text
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default Remove paragraph marks in Excel from Word-sourced text

I have a macro that extracts about 4,000 Word comments and puts them into an Excel table. Many of the comments have paragraph marks from Word that I need to get rid of.



When I try to search for these in Excel using Ctrl+J, it works.

But not really:

The data I'm executing the Find/Replace on are all in the same column; the column is set to wrap text. For each cell that contains text that has a paragraph mark, that text is displayed as if there were no line break. For example, here's what a cell looks like when it comes into Excel via a Word comment:
Code:
03.0–003 {FS} We believe it is possible with genetic tools.
When I initially search a cell for the paragraph mark, Excel does NOT find it.
However, if I double-click into the cell, the line break not only "activates," but remains when I exit the cell, that is, the text is now displayed as two lines, like so:
Code:
03.0–003 {FS} 
We believe it is possible with genetic tools.
It is only after I double-click into the cell, then exit, that Excel finds the paragraph mark.


EDIT: This one- to multi-line conversion doesn't occur if I hit escape to exit the cell - it only works if I click on another cell.

How can I search for the Word-sourced paragraph marks without first clicking into thousands of cells? Or, put another way, how can I simultaneously execute the act of double-clicking into thousands of cells so that I can "activate" the paragraph break and thus replace it via Find/Replace?


EDIT 2: I've added a sample file
Attached Files
File Type: xlsx Sample Data.xlsx (17.2 KB, 8 views)

Last edited by Peterson; 08-18-2020 at 10:16 PM.
Reply With Quote
  #2  
Old 08-18-2020, 09:30 PM
Purfleet Purfleet is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

Can you add a sample file so we dont have to recreate the data?
Reply With Quote
  #3  
Old 08-18-2020, 10:17 PM
Peterson Peterson is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Competent Performer
Remove paragraph marks in Excel from Word-sourced text
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default

I've added a sample file.
Reply With Quote
  #4  
Old 08-18-2020, 10:41 PM
Purfleet Purfleet is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

The character that is causing the issue is a Carriage return, i think it only shows when you go into the cell and press enter as the cell recalculates at that point



With the quick test that i have done the below code seems to remove them



Sub cr_remove()

Range("a:a").Replace what:=Chr(13), Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

End Sub
Reply With Quote
  #5  
Old 08-18-2020, 11:00 PM
Peterson Peterson is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Competent Performer
Remove paragraph marks in Excel from Word-sourced text
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default

Awesome -- thank you very much for looking at this and for the code!
Reply With Quote
  #6  
Old 08-18-2020, 11:20 PM
Purfleet Purfleet is offline Remove paragraph marks in Excel from Word-sourced text Windows 10 Remove paragraph marks in Excel from Word-sourced text Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

No problem, make sure it is okay and let me know if you need anything else
Reply With Quote
  #7  
Old 08-18-2020, 11:36 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Remove paragraph marks in Excel from Word-sourced text Windows 7 64bit Remove paragraph marks in Excel from Word-sourced text Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,920
Pecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond reputePecoflyer has a reputation beyond repute
Default

Please post in the VBA forum in the future for questions relating to macros
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove paragraph marks in Excel from Word-sourced text Quotation marks in text linked-in from Excel Igu Word 4 08-28-2021 05:57 PM
Help me, remove the marks occur at begin and last paragraph ngocanhwdn Word 6 06-25-2019 07:57 AM
Remove paragraph marks in Excel from Word-sourced text Paragraph marks appear suddently leonardevens Word 1 07-13-2015 12:14 PM
Finding Paragraph Marks BZee Word 4 02-14-2015 02:12 PM
Tab and paragraph marks do not appear in Word 2013 mamies Word 3 06-25-2014 11:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:03 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