+ Reply to Thread
Results 1 to 10 of 10

Auto fit Row Heights In Merged Cells

  1. #1
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Auto fit Row Heights In Merged Cells

    Hi,

    I have this code to fit row heights in merged cells. This works ok but it takes a few minutes to run. I also have the problem of when I insert a new row or delete a row these cell references are then no longer correct. Can anyone adjust this formula to speed it up and use maybe a named range to reference these cells so they adjust when rows are inserted and deleted before the code is run?

    Please Login or Register  to view this content.
    Thanks in advance for any help with this!
    Last edited by colin7; 06-29-2019 at 06:17 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Auto fit Row Heights In Merged Cells

    Welcome to the board.

    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with CODE tags.

    Thanks.

    EDIT: Thank you.
    Last edited by shg; 06-29-2019 at 05:12 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Auto fit Row Heights In Merged Cells

    Your merged cells horizontal, vertical, or both?

  4. #4
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Auto fit Row Heights In Merged Cells

    The merged cells go horizontally only column C to K

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Auto fit Row Heights In Merged Cells

    In the rare occasions when I do that, I make a spare column the same width as the merge area and put a formula in the same row e..g., =A2.

    Wrap text and autofit row height.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Auto fit Row Heights In Merged Cells

    On a side note. It looks like your array increases by 47 except "C534". Is that a stray or a slip of the keyboard finger?

  7. #7
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Auto fit Row Heights In Merged Cells

    Quite a good idea but as there are 200 cells it would annoy me knowing it calculating twice. My code actually works well, just the click of a button but my problem was it's not dynamic. I thought it would be quite simple for someone as good as yourself to make a few tweaks and maybe refer to a named range instead of every cell individually. Thanks for your help btw.

  8. #8
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Auto fit Row Heights In Merged Cells

    Hi, yes it should increase by 47 each time that is my mistake. A problem is I am inserting new rows or deleting rows so it could be more or less than 47 when I run the code.

  9. #9
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Auto fit Row Heights In Merged Cells

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Auto fit Row Heights In Merged Cells

    Thanks for your reply.

    This seems to make the row height a lot larger than it should be plus it is longer to run than my original code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. auto fit merged cells
    By dan_fash in forum Excel General
    Replies: 1
    Last Post: 07-25-2017, 01:34 PM
  2. Auto lock cells with a range that includes merged cells.
    By garyreid81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2014, 05:23 AM
  3. Replies: 0
    Last Post: 11-25-2014, 07:08 AM
  4. [SOLVED] Copying worksheet while keeping row heights of merged cells and active X controls
    By Chrispelletier in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-05-2014, 10:41 AM
  5. Replies: 1
    Last Post: 06-23-2006, 10:06 PM
  6. Auto fit in merged cells
    By LDF in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-20-2005, 02:45 PM
  7. How do I auto fit when the cells are merged together?
    By Christa in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-01-2005, 04:09 PM

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