• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Text wrap format as like word - in excel

nagovind

Member
Dear All,
i have a lengthy sentence and i placed it in cell C7
Printing area is B2:AM64 as there are small cell sizes due to many reasons refer attachment

Please advise the code to make the text wrap in vertically It breaks text intelligently based on the actual rendered width as per selection range at the right and in next line. No merging of cells

Regards
Narayan Govind
 

Attachments

  • Text Wrap as like word.xlsm
    300.1 KB · Views: 3
Could You use Textbox?
... NOW, sample with light green color and red border
So far without any coding.
 

Attachments

  • Text Wrap as like word.xlsm
    301.1 KB · Views: 3
In the attached is a very clunky offering.
On sheet page 1 there's a button at cell M3 which calls a macro Test, which in turn calls the macro blah with 3 arguments being in order:
  1. the cell with the lengthy string
  2. the cell where the output starts
  3. a range of cell(s) having the same width that you want the result wrapped at.
Notes:
Currently, it outputs to cell C8 of page 1
It's slow (10 secs here)
It does keep your character formatting (but it's hard work to do that)
Your lengthy string contains 12 non-breaking spaces as well as normal spaces so I've allowed those non-breaking spaces to be broken.
I haven't even begun to think about how to deal with carriage returns/linefeeds within your lengthy string.
There's the same button on sheet How it should be but you don't need that sheet at all.
 

Attachments

  • Chandoo58718Text Wrap as like word.xlsm
    318.1 KB · Views: 1
Back
Top