+ Reply to Thread
Results 1 to 10 of 10

Moved wrapped lines to individual cells.

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,954

    Moved wrapped lines to individual cells.

    Putting this here because I can't figure a way to do it any other way, but of course I COULD be wrong. Maybe I'm just too slow to figure it out.

    Okay, in the attachment my boss put in his info in Column B. Now I'm stepping it out in column D

    My bosses comments are wrapped, but the steps don't line up neatly with his steps, and I'd like to have each of his lines (and so mine as well) in a separate cell, but staying in the same column with the same width.

    So, for instance, his box for Projected Paid FTEs is currently occupying three cells (B4:B6). When all's said and I done it would occupy seven cells (B4:B10)

    Without manually copying/pasting, how can I do this? I tried with Text to Columns, but that moves everything to different columns, so I still have to copy and paste.

    What's the solution? I'd kind of like a macro solution, because this same situation happens all the time (I have a boss who loves Merging and Wrapping).

    Any help would be appreciated.
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Moved wrapped lines to individual cells.

    Is your process to type in column D of the top row all the information you have to enter, then expand the cell to align with the information in Column B? You say your data would fill to B10. Can you show us the end result of what you want seen and show us how you enter the data before rearranging to the end result?

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,530

    Re: Moved wrapped lines to individual cells.

    I think you are going to struggle. The only reason the text in a cell takes up however many lines is because of the column width. If you narrow it or increase the column width, it will increase or decrease the number of lines. So, the number of lines is just a function of the formatting. If you had new line characters in there, you could split the cell ... but you (and your boss) would need to press Alt-Enter to force the line break(s).
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,954

    Re: Moved wrapped lines to individual cells.

    Maniacb I've attached an updated sample. TMS, yes, it would definitly make a difference if I changed the column width, what I want to do is keep the same column width and convert each wrapped line to it's own line.

    In many cases I or my boss DO use line breaks, but not always. If the text wraps the way we want without a line break so much the better.

    But regardless of line breaks or not, wrapped text multiplies the row height, causing difficulty lining up comments on the side. Easier with single lines.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Moved wrapped lines to individual cells.

    Here is an option for you. Let us know how it works.

    Please Login or Register  to view this content.
    Last edited by maniacb; 04-25-2023 at 04:22 PM. Reason: Code cleanup

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,954

    Re: Moved wrapped lines to individual cells.

    That worked very well. Some minor formatting issues (some indents lost, some retained). I've attached the test results. I'll have to examine this macro in detail. Thanks so much!
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,954

    Re: Moved wrapped lines to individual cells.

    Some questions on the macro:
    What is the 110 value about?
    You define the column width, but if I were wanting to turn this into an on-the-fly macro I could select the text to unwrap, so capture the size that way, right?
    Same thing with calling out column B, selection would take care of that as well, right?
    I think all the restoring the formatting (like bolding, borders) I could take out. That's easily restored manually, and if it's lost during the unwrapping process that's not a deal breaker.

    One thing I'm not sure about are lines that begin with [B3], like so:
    Please Login or Register  to view this content.
    Is it B3 because that's where the data begins?

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Moved wrapped lines to individual cells.

    The 110 value defines how many characters fit in a cell that is 68.77 long. Right now the code uses a set column width and character count, but that can be changed for the code to read the column width and update the character count accordingly. Changing the letter B will update the column, although I have to make one update in the code for that to be true. B3 in those lines do designate where the data is populated into. *The update to the code to change B for the column change has been made.
    Last edited by maniacb; 04-25-2023 at 10:48 AM.

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,954

    Re: Moved wrapped lines to individual cells.

    I'm not seeing where you made the change. Unfortunately I need to get away from this post for a day or so while I work on a pressing issue but I will be back.

  10. #10
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Moved wrapped lines to individual cells.

    When you get back, here is another module you can use to break down a single cell into multiple rows. It will only work for font sizes between 8 and 16. The code in post #5 is currently set up to work on font size 10. I also made a correction to it. Let me know what you think.

    Please Login or Register  to view this content.
    Last edited by maniacb; 04-26-2023 at 10:01 AM. Reason: Expand font coverage

+ 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. [SOLVED] Counting the number of wrapped lines of text
    By lovecolorado in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-11-2020, 02:38 PM
  2. [SOLVED] Capturing Individual High and Low Values of cells on multiple lines
    By jaurdonjo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-02-2017, 10:32 AM
  3. [SOLVED] grid lines for individual cells
    By ffffloyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2012, 06:17 AM
  4. [SOLVED] Autofit in cells with multiple lines of wrapped text.
    By John Keith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2006, 03:10 PM
  5. [SOLVED] RE: Autofit in cells with multiple lines of wrapped text.
    By John Keith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2006, 11:35 AM
  6. Replies: 1
    Last Post: 12-15-2005, 07:55 PM
  7. number of lines of wrapped text
    By Fred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2005, 09:06 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