+ Reply to Thread
Results 1 to 4 of 4

Automatic Line Break at X number of characters

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    2

    Automatic Line Break at X number of characters

    How do I make a string automatically add a line break at X number
    characters for example:
    the following string:

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    Would be:

    Lorem Ipsum is simply dummy text of the printing a
    nd typesetting industry. Lorem Ipsum has been the
    industry's standard dummy text ever since the 1500
    s, when an unknown printer took a galley of type a
    nd scrambled it to make a type specimen book. It h
    as survived not only five centuries, but also the
    leap into electronic typesetting, remaining essent
    ially unchanged. It was popularised in the 1960s w
    ith the release of Letraset sheets containing Lore
    m Ipsum passages, and more recently with desktop p
    ublishing software like Aldus PageMaker including
    versions of Lorem Ipsum.

    It tried a loop with an insert function but couldn't get past the first pass.

    Thanks for any Mike

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Automatic Line Break at X number of characters

    Hi duyane and welcome to the forum,

    I have 3 possible answers for you on the attached. Two of them are VBA code. I hope this is what you are looking for.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    07-16-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Automatic Line Break at X number of characters

    Marvin, although I like option 3 because it breaks up the words, it sometimes goes past the 51 mark... I am going to make a function out of # 2. Thanks a ton!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Automatic Line Break at X number of characters

    Hey duyane,

    If you decrease the EndPtr instead of increase it you could keep the line length under 50 and still word break.
    Please Login or Register  to view this content.
    Last edited by MarvinP; 07-17-2012 at 02:15 AM.

+ 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