PDA

View Full Version : Excel Question: Row Height



Peter Stahl
02-01-2007, 6:15 AM
I have a Excel Worksheet that has items in the first column that can have more than one visible line. I there a way to check the cell to see if it needs to make the row height higher so all text is visible? I don't want the column any wider and definitely don't want all the rows at the same height. Want to make the marco check all the rows and make the adjustments.

Rob Russell
02-01-2007, 7:28 AM
Just set the cell alignment to "Wrap text" and the cells will autosize up as needed.

Select the cells;
Either Right click and select Format or from the menubar select Format, Cells;
Select the Alignment tab; and,
Make sure the Wrap Text box is checked.The above is for Excel 2003 - if you have a different version of Excel, the menus might be a little different but they will be very close.

One comment about the autosizing - the cells will size up automatically. If you edit the string in a cell such that it now doesn't need as much height, it will not autosize down. You'd need to adjust the Row Height - I'd use the Autofit to do that.

Jeffrey Fusaro
02-01-2007, 7:31 AM
i'm not sure that you can do what you are describing.

can you resize the text in the cell to keep the cell size from changing?

have you tried - "format" > "cells" > "alignment" > "shrink to fit"?

or

have you tried - "format" > "row" > "auto height"?

Russ Filtz
02-01-2007, 7:35 AM
Not sure how to do the Macro, but if you right click the row number, select "format cells", go to alignment tab, and then click the "wrap text", it should automatically resize the row height to get all text visible.

If you only want to do it in one column, then I would select the column letter. In the macro, you should be able to click and drag the range you want to reformat also.

You can also use the "CTL-1" command to get directly into cell formatting. Not sure if this shortcut can be used in macros. Haven't done that many macros myself!

Ted Shrader
02-01-2007, 8:39 AM
Peter -

In addition to Rob's suggestion you can quickly adjust an individual row by placing your cursor over the bottom divider for the desired row and dragging it down (or up). On th left where the row numbers are located, pick the desired row and adjust it. When your cursor is in the right place the symbol will change to a line with an up aroow and a down arrow.

Regards,
Ted

Peter Stahl
02-01-2007, 11:15 AM
Thanks for all the help. What I did that will work is I highlighted all the cells then Format > Cells > Alignment Tab > Wrap Text. Next I highlighted all the cells I wanted done and did a Format > Row > Autofit. This did exactly what I wanted. I didn't want to have to adjust them again one at a time and unless you re-edit that cell it won't change the height. Between all you guys I was able to get it done, thanks again very much, SMC is a great place, lots of knowledgeable people here!

Here's the line I added to my Macro to do the same thing I did above.

Selection.Rows.AutoFit

Jim Becker
02-01-2007, 12:17 PM
Double click on the line below the row and that row will auto size to fit.

Peter Stahl
02-01-2007, 4:25 PM
Double click on the line below the row and that row will auto size to fit.

Jim, I have a worksheet that I'm constantly updating and sorting so doing with a macro is much quicker.

Doug Shepard
02-01-2007, 6:18 PM
The Format painter button comes in handy for stuff like this too. If you select a row that already has the layout you want on another row then hit the Format Painter button, then click on the new row. All it's cell properties will change to match the first row.

Peter Stahl
02-02-2007, 2:31 PM
The Format painter button comes in handy for stuff like this too. If you select a row that already has the layout you want on another row then hit the Format Painter button, then click on the new row. All it's cell properties will change to match the first row.


Doug, thanks I didn't know there was a Format painter button. I'll check it out when I get a chance. The PC I'm on right now doesn't have Excel on it.

Doug Shepard
02-02-2007, 6:15 PM
Word has one too but I don't find it near as useful in Word. It looks just like a paintbrush. Basically it works like this: Select Something (one cell, one row, one column, 3 cells, 6 cells, etc.) then hit the Format Painter. You'll see the same effect around that area as if you hit Edit->Copy and put that area in the clipboard. Then touch the mouse cursor at the start of another area of the same size/shape/nbr-of-cells/whatever and click it. It will apply all the formatting of the first area to the 2nd. Pretty handy.