+ Reply to Thread
Results 1 to 12 of 12

Break lines based on cell text

  1. #1
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Break lines based on cell text

    Hi I am creating emails using VBA in Excel. For the body of the email I am taking the value of a cell. Example in D2 i have the following message, however once the email is created by VBA the entire message shows in one single line. How can I split ( break the line by comma)?

    Hi Stacie,

    I hope you are......



    HTML Code: 

  2. #2
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    If the email has a HTML body then the logic would be something like:
    Please Login or Register  to view this content.
    If it is not HTML then maybe the below logic would work:
    Please Login or Register  to view this content.
    Last edited by CheeseSandwich; 11-03-2022 at 10:25 AM.
    If things don't change they stay the same

  3. #3
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Break lines based on cell text

    Thank you, how would that fit in my code? Can you help? It is HTML

  4. #4
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    I can't see your code for some reason so difficult to say. Can you see the code in your first post?

  5. #5
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Break lines based on cell text

    I do not see either, here we go again

    Please Login or Register  to view this content.

  6. #6
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    I see it now.

  7. #7
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Break lines based on cell text

    That worked great thanks however I want to break the line each time I click Enter, what change is needed?

  9. #9
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    Do you mean whne you click ALT+Enter to go to new line within a cell?

    In the OP it stated "( break the line by comma)" so i assumed the line break was going to be done with a comma within the cell where the body text resides.

  10. #10
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Break lines based on cell text

    You are correct, I would not have said by comma because in each comma the lines break. I mean click ALT+Enter to go to new line within the same cell.

  11. #11
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2405-17628.20102
    Posts
    1,413

    Re: Break lines based on cell text

    Maybe this:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Break lines based on cell text

    Thank you that worked

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Long text to break in parts, lines
    By pmbhome in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 06-22-2021, 02:19 AM
  2. [SOLVED] Color lines within the same cell separated by line break
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-27-2018, 10:38 PM
  3. Adding Lines based on Text in a Cell
    By adigiro1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2017, 09:58 AM
  4. Insert Lines based on Cell value, Find Last Occurrence of text, Delete Previous Informatio
    By FranktheBank in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2015, 03:49 PM
  5. [SOLVED] Print lines to a text file based on change in cell contents
    By cthreepo986 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2013, 09:53 AM
  6. Text to Excel with pre-defined break lines using Macro
    By jameel30 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 02:43 PM
  7. Break cell into multiple lines by line break
    By Chia in forum Excel General
    Replies: 1
    Last Post: 08-20-2006, 01:40 AM

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