+ Reply to Thread
Results 1 to 6 of 6

Adjust row height based on cell value

  1. #1
    Registered User
    Join Date
    11-21-2006
    Posts
    73

    Adjust row height based on cell value

    How might I adjust the height of a row based on the value that is in column F?...

    Specifically,

    No row height should ever be less than 20 px. but otherwise row height is a function of the value in Column F.
    Row height = (F divided by 30)*20
    This would vary row by row.

    If the value F3 is 120: 120/30 = 4, 4*20 = 80 .row height of row 3 becomes 80px.
    If the value F4 is 60: 60/30 = 2, 2*20 = 40 ... row height of row 4 becomes 40px.

    Thanks in advance

    Josh

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Josh. Right-click on the sheet tab, select view code, and copy this code. Let me know if it is what you are looking for:
    Please Login or Register  to view this content.
    This will only work if you are changing one cell in column F at a time. If you plan to change more than one at a time (i.e. copy and paste to a range of cells), then the code will need to be modified.

    HTH

    Jason

  3. #3
    Registered User
    Join Date
    11-21-2006
    Posts
    73
    Thanks for the help!

    As it turns out, there are conditions that exist which cause cascading changes to the values in F. Would you know how to make the modifications you mentioned?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Try this one. Hopefully it will work for you:
    Please Login or Register  to view this content.
    Jason

  5. #5
    Registered User
    Join Date
    11-21-2006
    Posts
    73
    Hmm,

    Now all of the row heights adopt the height of the active cell rather than the value that is in column F of that row.

    Is there a way to systematically refresh the values in F? So that the code you provided for the One-at-a-time method could be automated?

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hey, Josh, sorry, I missed changing one of the items in the revised code. Try this:
    Please Login or Register  to view this content.
    Jason

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1