ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy Word tables to Excel (https://www.excelbanter.com/excel-discussion-misc-queries/12692-copy-word-tables-excel.html)

Don

Copy Word tables to Excel
 
I'm sure there might be a solution, I just can't find it
now.....

I have a table in Word that might or might not
contain "returns." I want the table in Word to copy
EXACTLY as is into Excel.

If I have Don (hard return) Mike in one Word table cell.
It splits this into two cells in Excel. Any way to
prevent this. Pasting as a Word document is not an option

Thanks so much in advance.

Richard Neville

Replace the hard returns in Word with end-of-line marks (hold down shift key
when you press Enter).

"Don" wrote in message
...
I'm sure there might be a solution, I just can't find it
now.....

I have a table in Word that might or might not
contain "returns." I want the table in Word to copy
EXACTLY as is into Excel.

If I have Don (hard return) Mike in one Word table cell.
It splits this into two cells in Excel. Any way to
prevent this. Pasting as a Word document is not an option

Thanks so much in advance.




Martin P

Change all hard breaks in the table to something like ¥, or anything else
that does not otherwise appear in the text. Then copy to Excel. Use a macro
to change ¥ to a manual line break. You will have to do with a manual line
break; a hard return does not seem possible. I do not have a macro available
right now. What it does is change Don¥Mike to "Don"&Chr(10)&"Mike". Perhaps
somebody else is willing to do the macro part before I get there.

"Don" wrote:

I'm sure there might be a solution, I just can't find it
now.....

I have a table in Word that might or might not
contain "returns." I want the table in Word to copy
EXACTLY as is into Excel.

If I have Don (hard return) Mike in one Word table cell.
It splits this into two cells in Excel. Any way to
prevent this. Pasting as a Word document is not an option

Thanks so much in advance.


Martin P

I have created a macro for the final stage of having your Excel table look
like the Word table (see my other post);

Sub copyhardreturns()
'This program changes ¥ to manual line breaks
For j = 1 To 50
For k = 1 To 50
i = 0
While i < Len(Cells(j, k))
i = i + 1
If Mid(Cells(j, k), i, 1) = "¥" Then
Cells(j, k) = Mid(Cells(j, k), 1, i - 1) & Chr(10) & Mid(Cells(j,
k), i + 1)
End If
Wend
Next k
Next j
End Sub

My procedure is then:

(1) In Word, replace returns with ¥.
(2) Copy the contents of the Word table to Excel
(3) In Excel, run this macro.

You might have to adjust the values for the for ... to ... next part.

"Don" wrote:

I'm sure there might be a solution, I just can't find it
now.....

I have a table in Word that might or might not
contain "returns." I want the table in Word to copy
EXACTLY as is into Excel.

If I have Don (hard return) Mike in one Word table cell.
It splits this into two cells in Excel. Any way to
prevent this. Pasting as a Word document is not an option

Thanks so much in advance.



All times are GMT +1. The time now is 12:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com