Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2001
    Location
    Gauteng, South Africa
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to auto-adjust row height (2000)

    Hi all
    I'd like to adjust the row heights to the values in a column, say from B2 downwards. So if the value of B2=14.5, then the row height for row 2 must be 14.5, if B3=8.1, then row 3's height should be 8.1, etc. Any way to automate this - my VBA knowledge is restricted to recording macros and it does not work the way I want.

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

    Re: Macro to auto-adjust row height (2000)

    Try this macro:

    Sub AdjustHeights()
    Dim lngRow As Long
    Dim lngMaxRow As Long
    lngMaxRow = ActiveSheet.Range("B65536").End(xlUp).Row
    For lngRow = 2 To lngMaxRow
    ActiveSheet.Rows(lngRow).RowHeight = ActiveSheet.Cells(lngRow, 2).Value
    Next lngRow
    End Sub

    It assumes that you have filled a contigous range from B2 down to the last row whose height you want to set.

  3. #3
    New Lounger
    Join Date
    Mar 2001
    Location
    Gauteng, South Africa
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to auto-adjust row height (2000)

    Hans
    I've heard about quick replies, but this is getting ridiculous <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> ! Yes, it worked perfectly. How you guys figure it out so quickly remains a mystery to me. . . . .

    Thanks!

Posting Permissions

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