+ Reply to Thread
Results 1 to 13 of 13

Autoheight + buffer space for select rows

  1. #1
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Autoheight + buffer space for select rows

    I found a few related topics, but none that were exactly what I needed--largely because I've worked a lot with spreadsheets, but have no experience with how macros work, so I don't know how to go about using most of the answers that were given.

    I have a spreadsheet that I need some way to add some buffer space to the bottom of a certain selection of rows, 5px or so. I'm not even sure what my options are for whether this would happen automatically or where to put the code or anything, so any and all help would be fantastic.

    I'm really glad so many people like helping out us newbs for fun! I really appreciate you guys!

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    Can you upload a sample workbook with some data and show what the data looks like before and after?
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    Um, it's not specific for this spreadsheet, so I don't think there's a need for me to upload anything. It could be done for any spreadsheet--I just need rows # through # to be adjusted to autoheight + 5px. They're just regular old text, no formulas or adjusted size or length of rows or anything. Is there specific information more than that that you'd need?

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    I miss read your post sorry.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    I don't know exactly what to do with this. I'm pretty new to any kind of excel coding. Could you be so kind as to help me out with where this needs to go? =)

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    Please Login or Register  to view this content.
    1. Copy the sample code
    2. Open the workbook in which you want to add the code
    3. Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    4. Choose Insert | Module
    5. Where the cursor is flashing, choose Edit | Paste

    1. On the Excel Ribbon, click the View tab
    2. At the far right, click Macros
    3. Select a macro in the list, and click the Run button

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    And heres a site you can reference

    http://www.contextures.com/xlvba01.html

  8. #8
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    Mike,

    First, thanks so much for your help so far.

    I've got the macro working, but unfortunately it shrinks the rows to a really small size. Is there a way to adjust it to the proper autoheight, and then add another 5px to that?

    Thank you again!

    PS--Will this work for merged cells and cells with line breaks/more than one line?

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    Try this

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    Great, almost there. I just have two more questions.

    1. How can I make this work on lines that have word wrapping?

    2. Is there a simple way to make this check whether a row has already had the height adjusted so that when I run the macro more than once, it doesn't just keep adding 5px to the row height?

    Again, thank you so much. There are a lot of little tweaks I didn't realize I'd have until I was tinkering with it.

  11. #11
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Autoheight + buffer space for select rows

    1. How can I make this work on lines that have word wrapping?
    You would as far as I know need to loop thru the cells and check for line breaks. What Column does your data have the line breaks?

    2. Is there a simple way to make this check whether a row has already had the height adjusted so that when I run the macro more than once, it doesn't just keep adding 5px to the row height?
    Only thing I can think of is Autofit the cell back to normal then add back the 5px

  12. #12
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    The text wraps in the merged columns C-G. What code would I need to use to do the autofit/re-add bit?

  13. #13
    Registered User
    Join Date
    10-08-2012
    Location
    Grand Rapids, MI
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Autoheight + buffer space for select rows

    *bump* I know it's been a while, but can anyone help me finish this so I can close it?

    Thanks!

+ 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