Consulting

Results 1 to 3 of 3

Thread: Solved: Merge Cell Autofit (

  1. #1

    Solved: Merge Cell Autofit (

    This thread was marked solved and it still has a problem. The code does what it is supposed to do, but when you tab out of the cell it takes you to the palceholder which is out in no man's land. Once the macro has run the only way to get it back is to hit enter twice??? OR to use the mouse. Would setting up a tab order fix this or would it just screw up the other macro?


    Quote Originally Posted by mvidas
    That is a tough question! Autofit doesn't work on merged cells unfortunately. Luckily, a workaround has been created by Brad Yundt (byundt). Take a look at his solution here:
    http://www.experts-exchange.com/Q_21....html#12994257
    I have used this in the past, and works exactly as desired.

    One thing you might want to do is get rid of those merged cells! They confuse VBA to no end, and just have more trouble than they're worth a lot of the time. You might want to take a look at the "Center across selection" option for Horizontal Alignment of a cell.
    To use this, just to give you a quick example, create a new sheet and select cells A1:C1. Go to Format / Cells, then the Alignment tab, and change the horizontal alignment to 'center across selection'. Click ok. Now, in A1, type something. It is centered across those cells, even though they're not merged. It won't help you in this autofit issue, but it does alleviate a lot of the other problems that stem from merged cells.

    Matt

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi cleturno,

    FYI, I have emailed Brad/Byundt regarding this question. Hopefully he can stop by here to help, or someone else can help you.

    As an FYI for everyone, the quoted text above is from http://www.vbaexpress.com/forum/showthread.php?t=6072

    Matt

  3. #3
    I was unaware that an E-mail had been sent thank you for the update.

Posting Permissions

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