cell margins

K

katrina

I know I can indent text in a cell from the left and from
the right of the cell, but can anybody please tell me how
to indent it from the top and bottom? I want to be able
to autofit my rows to my text but leaving a gap at the
top and bottom so it's not all squashed. I know I can
make the rows bigger and then centre the text vertically,
but this is for a very big document so I don't want to
have to manually size each row.
 
J

Judy Freed

Apologies if I have misunderstood, but check under Format, Cells, Vertical
Alignment, Center.

I am not sur if that is what you want, but maybe....

Judy Freed
Systems Development
 
M

mikelee

if no one has an easier way for you, you could center the
text vertically, then use a macro to autofit the rows for
you. something like this should get the job done:

Sub SizeRowsandCols()
ActiveSheet.UsedRange.Select
Selection.Rows.AutoFit
'Selection.Columns.AutoFit
End Sub

if you wanted to autofit the columns also, you could
simply remove the ' from in front of the
Selection.Columns.Autofit line and it would do both.

hope this helps.

mike
 
V

VENKAT

highlight all the cells
format(menu)-cells-alignment-vertical-choose one of the items.

But cell height should be bigger than the entry format.
to see this.
 
R

rasty_9

I don't think any of the respondents answered Katrina's question, and I have
the same question. Maybe if I restate it.
In MS Word tables, you can set a white space margin within the cell, on each
border of the text (i.e., left, right, top, bottom) to improve readability.
If the text wraps to a new line, these margins are maintained. I do not see
any parallel capability to do that in Excel. If you manually set the height,
then wrapped text will be partially hidden. Am I right or wrong?
 
G

Gord Dibben

Try this macro to indent left and add a blank line top and bottom then wrap
text and autofit.

Note: won't work with "merged" cells.

Sub Indent_Text()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = Chr(10)
For Each Cell In thisrng
With Cell
.Value = moretext & Cell.Value & moretext
.Rows.AutoFit
.IndentLevel = 2
End With
Next
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top