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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Word table to Excel

Status
Not open for further replies.

MarcLodge

Programmer
Feb 26, 2002
1,886
GB
Hi All,
I have a table in Word that I'd like to move to Excel in order to do some totalling, and filtering etc. The table has got carriage returns in many of the rows so that one row can spreads over numerous lines on the written page.

What I would like to do is port this straight into Excel, but the problem I am having is whenever Excel finds a carriage return, it moves down a row in the worksheet. What I need is for the formatting of the table in Word to be applied to Excel ie. if a row in the table in Word is 4 lines deep, then I'd like the cell/row in Excel to carry the CRs across and only put it in one cell/row, not four.

Can you understand what I am trying to do, and is there an easy way to do it without re-typing?

Many thanks,

Marc
 





Hi,

In Word, replace the line feeds with spaces. The copy 'n' paste into Excel.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Or, if you absolutely want to keep the line breaks, replace them in Word with a unique character combination like {|}, copy to Excel.
Unfortunately, you cannot replace with a special character like line feed in the standard Excel Replace dialog, so you'd have to do this with a little macro:
Code:
Sub MyReplace()
    Cells.Replace What:="{|}", Replacement:=Chr(10), LookAt:=xlPart, SearchOrder:=xlByRows
End Sub

Note: This will not work if the cells contain more than 1024 characters! Excel tolerates cell volumes up to 32k, but it does not like them!

Cheers,
MiS

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Skip, Makeitso,

Two excellent suggestions that I just hadn't thought of. I shall be using either/both of them.

Many thanks

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top