cleturno
02-15-2006, 07:26 AM
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?
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_21266648.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
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_21266648.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