ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lines in cell? (https://www.excelbanter.com/excel-programming/339159-lines-cell.html)

Helmut Weber[_2_]

Lines in cell?
 
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"








bigwheel

Lines in cell?
 
The helpfile item "Worksheet and workbook specifications" should give you a
guide to the limits of Excel

"Helmut Weber" wrote:

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"









Dave Peterson

Lines in cell?
 
I think Helmut was looking to find a way to determine how many times the cell
wrapped to new lines (with no alt-enters in the cell).



bigwheel wrote:

The helpfile item "Worksheet and workbook specifications" should give you a
guide to the limits of Excel

"Helmut Weber" wrote:

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"









--

Dave Peterson

NickHK

Lines in cell?
 
Helmut,
Using a fixed-width font should get you close.

NickHK

"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"










Jon[_20_]

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"










Peter T

Lines in cell?
 
Hi Helmut,

I suspect it can be done, but if it can would involve a lot of work. Is it
worth it ?

If it is REALLY worth it, for an idea of what I have in mind, I posted
something partially related in DicksBolg
http://www.dicks-blog.com/archives/2005/05/16/1131/

I had problems posting there, "<=" just halts and "0)" produces a smiley.
I did it in chunks, look for posts 4, 5 & 6. It'll take some reassembling.
Anyway, what I have in mind is fitting to a texbox same width as the column.
But I'll leave that to you!

Regards,
Peter T

If you can't piece that code together contact me and I'll forward the
original.
pmbthornton gmail com


"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"










Helmut Weber[_2_]

Lines in cell?
 
Hi Peter,

Hi Helmut,

I suspect it can be done, but if it can would involve a lot of work. Is it
worth it ?


Sorry to say so, No.

There are more than 500 rows in the sheet,
with more than 20 columns.

But you've opened my eyes to what is doable,
if it had to be.

Thank You.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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


All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com