Thread: Lines in cell?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jon[_20_] Jon[_20_] is offline
external usenet poster
 
Posts: 22
Default Lines in cell?

If your text is in row 6 for example, Paste this into a code window and then
run it:

Private Sub rowfit()
Rows("6:6").EntireRow.AutoFit
End Sub

If you are trying to do it without a macro I'm not sure if you can do it
without double clicking between the row numbers to autofit it (which does
work for me). If you don't mind a macro, then you could do a target macro
that would autofit every cell change in a chosen range.

"Helmut Weber" wrote in message
...
Hi everybody,

if anybody of those, who told me before
"no way", is reading this, forgive me for trying again.

I'd like to know, how many lines there are in a cell.
The cell's format alignment is set to "wrap text".
There are no forced linefeeds.
The text is about 200 to 1000 characters long.
Lines may hold about 60 characters.
There are no merged or split cells.

The reason for all this is to overcome somehow
Excel's seemably buggy "format row autofit",
as after executing "autofit" still not all lines in a cell
are displayed. If I increase the row's hight sufficiently,
I see all of the text. I thought about counting
the lines in a cell, get font size and set
the row's height to a value resulting from the font size
and the number of lines.

BTW:
There is no way for me to prevent users in all of the world
from misusing Excel as a word-processor.
<sigh

Any ideas?

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"