Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove all hard returns from word 1

Status
Not open for further replies.

Joe1010

Programmer
Dec 11, 2006
49
US
I’m copying a table from a word documents into excel.
However, every hard rerun (Enter) creates a new row in excel.

Is there any way to remove all hard returns from a word document?
Thanks
 




Hi,

In Edit/Replace - replace Paragraph with Manual Line. (special characters)

Skip,

[glasses] [red][/red]
[tongue]
 
Does that actually work for you Skip? For me that does replace the paragraph marks with line breaks, but they still come out as separate rows if I copy it to Excel.

faq219-2884

Gerry
My paintings and sculpture
 


Yea, I noticed that too.

If you copy a TABLE, and PASTE in Excel, it does not differentiate between CRLF and LF.

I wonder if there is any way to do it with native functionality?

Seems as if you'd need a VBA procedure to do as specified. You would have to go cell by cell, without copy 'n' paste. maybe something like this???
Code:
for each tbl in activedocument.tables
  'one table per sheet
  set ws = xl.activeworkbook.worksheets.add
  for each cel in tbl.range.cells
     ws.cells(cel.row, cel.column).value = cel.value
  next
next


Skip,

[glasses] [red][/red]
[tongue]
 
In Word, use Edit, Replace to replace line feeds. Say, Replace ^p with ***

Copy paste in Excel. Use Edit, Replace again. This time replace *** with ALT/0010 (using the numeric keypad)

Member- AAAA Association Against Acronym Abusers
 



* is acting as a wildcard in Excel find/replace????

Skip,

[glasses] [red][/red]
[tongue]
 
Sorry, I was giving an example. I usually use $$$. I didn't try it. I should have.

Member- AAAA Association Against Acronym Abusers
 



Well I substituted +++, but now I'm having trouble with the alt part.

Skip,

[glasses] [red][/red]
[tongue]
 
ALT/0010 is the same as using ALT/Enter in Excel. I just tried it quickly and it works for me.

Member- AAAA Association Against Acronym Abusers
 
Can't try it, but will paste special/text work?

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
No, it really messes up the table.

Member- AAAA Association Against Acronym Abusers
 
If you have Microsoft access, you may have better luck just blocking, copying and pasting your Word table data into a blank Access table that you've created with the correct number of columns (fields). You may still have a bunch of blank lines, which you can sort and just delete as a big clump. Then you can export it to Excel much easier.

cat.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top