Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    Marlborough, Massachusetts, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    expand cell to take all text (W98, O2k SR-1)

    I have a 1k row list of names address etc. I would like to add a column of notes. I would like the row height to expand to accept the size of the notes. I have seen them expanded but cannot figure out/remember how to do it. I would like it to be more or less automatic, ie type and the row expands but manually sizing the row to what is needed for the text wrapping is Ok too. thanks for the help.
    regards,

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: expand cell to take all text (W98, O2k SR-1)

    If the notes are in column C of Sheet1, then the following code in the Worksheet Change event in the module behind Sheet1 will do that.

    <pre>Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If Not Intersect(Target, Worksheets("Sheet1").Range("C:C")) Is Nothing Then
    Target.EntireRow.AutoFit
    End If
    End Sub
    </pre>

    Legare Coleman

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: expand cell to take all text (W98, O2k SR-1)

    Not sure of exactly how much trouble you want to go through.

    Another way without any code is to select your comments column (eg, click on the C for the entire column C). Then click Format | Cells. Click the Alignment tab and check the box for wrap text.

    You can adjust your col width to whatever you want. Then when you type, the text will fill the col width as set and wrap to the next line, thereby expanding the row height.

    Only problem might be if you later expand or contract your comments column. If you expand it, the row may show a blank line if the comment now takes less lines than it did. If you contract it, you may not see all the lines of the comment.

    Not sure how Legare's code would address some of the above problems.

    You can double click on the line dividing the row numbers on the left side of the screen to automatically adjust the row height (similar to what you can do for cols). You can also drag a dividing line between rows.

    Above is for Excel 97, which is what I'm running here at home. Hope some of this helps.

    Fred

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: expand cell to take all text (W98, O2k SR-1)

    Formatting the cell alignment to include word wrap should automatically expand the row height to accomodate the data.

    Andrew C

  5. #5
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Quakertown, PA, Pennsylvania, USA
    Posts
    517
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: expand cell to take all text (W98, O2k SR-1)

    Andrew's answer should work fine, but it will not work if you have merged cells. Merged cells will not automatically increase in row height.

Posting Permissions

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