Consulting

Results 1 to 4 of 4

Thread: Get rid of extra row height with Word Wrap

  1. #1
    VBAX Newbie
    Joined
    Mar 2017
    Posts
    5
    Location

    Cool Get rid of extra row height with Word Wrap

    Hello,
    is there a way to get rid of the extra row height when the first line in the cell is full and Word Wrap activated?
    See the Screenshot in the Attachment for better understanding. Here the Problem is the first line.
    If more lines in the cell have the same problem, then you get 1 extra line for each, i.e. in the second picture 3 extra lines.
    AutoFit_doesnt_work_with_word_wrap.png AutoFit_doesnt_work_with_word_wrap_aditive.png
    - activated Word Wrap
    - activated Auto-fit
    - no blank spaces after the last "l"
    - Calibri 11
    - Column width 10,86

    If i adjust the columns width then the Auto-fit works properly.
    But if you have enough rows you will never get a columns width that fits for all rows.

    I searched many times in the web and this forum, but can only find people complaining without solution.
    Can i solve the problem with a macro or a basic excel configuration?

    thank you for your help

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Excel is not very clever at text spacing, resulting in the unpopulated space. You could try a non-proportional font eg. Courier or as I do, align the text to the top of the cell and live with the space at the bottom.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    The closest I've ever gotten is using something like this


    Before

    Capture.JPG


    After

    Capture2.JPG



    Option Explicit
    Sub Macro2()
        
        Columns("B:C").ColumnWidth = 200
        Rows("1:3").EntireRow.AutoFit
        Columns("B:C").EntireColumn.AutoFit
        Columns("B:C").VerticalAlignment = xlTop
    End Sub
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Newbie
    Joined
    Mar 2017
    Posts
    5
    Location
    mdmackillop: i use normally "top" alignment, here just posted this way because it is the default. Font Courier would solve the Problem because each letter has the same width, but is not nice to show in meetings.
    paul: i tryied the macro but in my case i dont get any reaction to Rows(...).EntireRow.AutoFit. With Columns(...).EntireColumn.AutoFit i get "first line" and in the next line "full", some reaction to dobleclick on the right border of the column name.
    Does your cell show the empty lines after editing and just press enter?

Posting Permissions

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