Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Apr 2005
    Location
    Smyrna, Georgia, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adjust roll height to 'At Least' a certain size (Excel 97)

    I am looking for a formula that would allow all of my cells to adjust to a certain row height (28.5) but also allow for the cell to be at a larger height if necessary.

    In other words I do not want any cells smaller then 28.5.

    Is there a formula for this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adjust roll height to 'At Least' a certain size (Excel 97)

    You cannot adjust row height in a formula, you need VBA code to do that. Here is a macro that will adjust the height of all rows in the selection:

    Sub AdjustRows()
    Dim r As Range
    For Each r In Selection.Rows
    If r.RowHeight < 28.5 Then
    r.RowHeight = 28.5
    End If
    Next r
    Set r = Nothing
    End Sub

  3. #3
    Lounger
    Join Date
    Apr 2005
    Location
    Smyrna, Georgia, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adjust roll height to 'At Least' a certain size (Excel 97)

    Good Afternoon Hans.............. I know I am not doing something correct because this is not working............. should I be adding something in the Sub AdjustRows(????)

    I have tried to add (A20:BF65093) but I am still getting an error...............

    Any solutions??

    Sub AdjustRows()
    Dim r As Range
    For Each r In Selection.Rows
    If r.RowHeight < 28.5 Then
    r.RowHeight = 28.5
    End If
    Next r
    Set r = Nothing
    End Sub

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

    Re: Adjust roll height to 'At Least' a certain size (Excel 97)

    Are you selecting the rows that you want to adjust the height on before you run the macro?
    Legare Coleman

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adjust roll height to 'At Least' a certain size (Excel 97)

    If you want to apply this to a specific range instead of to the current selection, change

    For Each r In Selection.Rows

    to

    For Each r In Range("A20:A65093").Rows

    For the entire worksheet, use

    For Each r In ActiveSheet.Rows

  6. #6
    Lounger
    Join Date
    Apr 2005
    Location
    Smyrna, Georgia, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adjust roll height to 'At Least' a certain size (Excel 97)

    That worked!

    Thanks Hans, I really appreciate it!

Posting Permissions

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