+ Reply to Thread
Results 1 to 7 of 7

Convert Word Table to Single Excel Cell with Linefeeds

  1. #1
    Registered User
    Join Date
    03-26-2012
    Location
    Madison, NJ, USA
    MS-Off Ver
    Microsoft Office 2011
    Posts
    4

    Convert Word Table to Single Excel Cell with Linefeeds

    I am receiving the results of a Web-based test via e-mail. I am able to paste the e-mail's contents into an Excel spreadsheet and use it to manipulate the data as necessary, with one exception, namely an answer that requires the test taker to write a multi-paragraph e-mail response. I am able to identify which cells in Column A this answer occupies, for sake of argument, A60 to A70.

    I want to have the contents of these cells appear in a single cell, B60, with linefeeds. I did find an Excel macro on this forum:

    Please Login or Register  to view this content.
    This works after a fashion, but there are undesirable leading spaces at the beginning of each paragraph.

    If I instead copy the cells into a Word document, I notice that they come through as a table. If I convert the table to text in Word, then paste it back into the formula bar of B60, I get what I want.

    My question is, can this be done wholly within Excel, without the need for Word?

    Thanks in advance for any help on this.

    Burt Spielman
    Madison, NJ
    Last edited by bspielman; 03-28-2012 at 05:21 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    Hi Burt
    Welcome to the board

    Using your example, to copy the values in cells A60:A70 to B60, separated with linefeeds:

    Please Login or Register  to view this content.
    Does this help?

  3. #3
    Registered User
    Join Date
    03-26-2012
    Location
    Madison, NJ, USA
    MS-Off Ver
    Microsoft Office 2011
    Posts
    4

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    Quote Originally Posted by lecxe View Post
    Hi Burt
    Welcome to the board

    Using your example, to copy the values in cells A60:A70 to B60, separated with linefeeds:

    Please Login or Register  to view this content.
    Does this help?
    Yes! I did need to change "vbLf" to "chr(13)" in order to get the linefeeds to show properly. Perhaps it's because I'm using Excel 2011 on a Mac and the coding is slightly different.

    Thanks for your help.
    Last edited by bspielman; 03-30-2012 at 04:47 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    You're welcome. Thanks for the feedback.


    Quote Originally Posted by bspielman View Post
    Yes! I did need to change "vbLf" to "chr(13)" in order to get the linefeeds to show properly. Perhaps it's because I'm using Excel 2011 on a Mac and the coding is slightly different.
    Remark: the character with the code 13 is the Carriage Return. If you want you can use the vba literal vbCR.

  5. #5
    Registered User
    Join Date
    03-26-2012
    Location
    Madison, NJ, USA
    MS-Off Ver
    Microsoft Office 2011
    Posts
    4

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    Quote Originally Posted by lecxe View Post
    You're welcome. Thanks for the feedback.

    Remark: the character with the code 13 is the Carriage Return. If you want you can use the vba literal vbCR.
    Thanks again.

    I altered the code to
    Please Login or Register  to view this content.
    where the indirect functions refer to cells where I've identified the beginning and ending rows of the range of cells I want to combine. I've also concatenated an additional vbCR to insert a leading carriage return, desirable for cosmetic reasons.

    With an interactive button on the spreadsheet to activate the macro with a single click, it's pretty nifty.

  6. #6
    Registered User
    Join Date
    03-26-2012
    Location
    Madison, NJ, USA
    MS-Off Ver
    Microsoft Office 2011
    Posts
    4

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    OK, this scheme has been working well for me, but I have run into one minor glitch: Sometimes the values (as above) of "indirect(e1)" and "indirect(e2)" are identical. In this case the macro fails. How can I accommodate this instance?
    Last edited by arlu1201; 11-04-2012 at 05:20 AM. Reason: Do not quote whole posts.

  7. #7
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: Convert Word Table to Single Excel Cell with Linefeeds

    Possibly:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1