View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.newusers
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 279
Default wrap text inserts a padding blank line

I use Excel 2003 (11.5612.5606).

I thought I had a row autofit problem; I actually seem to have a wrap
text problem. I have a cell in which the text can fit in one line; when
wrap text is set, the cell is two lines deep.
I have seen many descriptions of this problem; I have seen neither
explanation nor solution.

To demonstrate the problem:
1) open a new workbook;
2) Either:
a) in A1, set the column width to 600 pixels, the font as Tahoma, Bold,
Italic and the text on one line to
12345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 2345678 8 2
At this point, the text is in one line and can all be seen.
Setting wrap text on the cell causes it to consist of a line of text and
a blank line.

or
b) run VBA code similar to this: (I recorded a macro and tweaked it.)
(You may hit a line wrap error ;)
Columns("A:A").ColumnWidth = 74.38 ' 600 pixels
Range("A1").Select
With Selection
' Let's have Tahoma, Bold, Italic
With .Font
.name = "Tahoma"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Bold = True
.Italic = True
End With
' Fill the cell on one line
ActiveCell.FormulaR1C1 = _
"12345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 2345678 8 2"
' WrapText causes the cell to consist of text and a blank line
.HorizontalAlignment = xlGeneral
' .VerticalAlignment = xlBottom
.VerticalAlignment = xlJustify
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

If I remove a couple of characters from the line and put them back
again, the blank line disappears.

I would value an explanation of Excel's behavior (sic).

I would also value any constructive criticism of the way in which I have
presented the problem to allow anyone interested to repeat my
observations.
--
Walter Briscoe