Results 1 to 3 of 3

Thread: Excel: How To: Neatly format Text cell with "Wrap text"???

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Question Excel: How To: Neatly format Text cell with "Wrap text"???

    Esteemed Forum Participants and Lurkers:
    ===============================
    EXCEL

    I print a lot of Excel sheets, and I always have columns of cells with user input ("Comments", etc.). They always vary from 1 or 2 words to a brief paragraph. I have a lot of trouble getting the cells sized properly after I set the font and column widths for the sheet. Some of the text columns are imported from other data bases, so they don't have the "Wrap text" property set when they are pasted into the Excel sheet. We print hundreds of copies of the sheets, so I try to fit as much as possible on a page.

    Here is the code I use for one of my sheets ... the font is 8 point arial, and all cells that need "Wrap text" already have it set.
    Code:
    Sub Squish()
    Dim ShtArea As Range
    Dim nrow As Integer
    Dim i As Integer
    
    Set ShtArea = ActualUsedRange(ActiveSheet)  'From previous forum post
    nrow = ShtArea.Rows.Count
    For i = 3 To nrow                                'Don't mess with 2 header rows
      With ActiveSheet.Rows(i)
        .EntireRow.AutoFit
        'Fit the row height for any number of rows
        .RowHeight = (.RowHeight * 0.9845) - 1.3  'Optimized for Arial 8 pt.
      End With
    Next i
    ' Just Autosize the bottom row
    ActiveSheet.Rows(i - 1).EntireRow.AutoFit
    
    End Sub
    Does anyone have any good efficient general suggestions for how to "Squish" rows to properly fit "Wrap text" cells? Are there any sequences of setting column width, "Wrap text", and font size that work better than others?

    Thank you for your gracious suggestions, comments, and assistance.
    Last edited by Webtest; May 19th, 2005 at 07:07 AM. Reason: Changed headline to correct cell property name.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Click Here to Expand Forum to Full Width