ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Row Height depending on cell content... (https://www.excelbanter.com/excel-programming/395361-set-row-height-depending-cell-content.html)

Trevor Williams

Set Row Height depending on cell content...
 
Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor

JLGWhiz

Set Row Height depending on cell content...
 
Are you asking if there is a maximum number of lines that can be entered in a
cell or are you asking if a user can determine the number of lines based on a
fixed column width and a known text length?

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


JLGWhiz

Set Row Height depending on cell content...
 
I don't know if this will help, but these are the limits prior to xl2007.

You can enter a row height of 0 (zero) to 409. If the row height is set to
0, the row is hidden. You can enter a column width of 0 (zero) to 255
characters. If the column width is set to 0, the column is hidden.

Generally speaking, the autofit and word wrap functions should set the width
and heigth to accomodate whatever you enter that are within the above
limitations.

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


Trevor Williams

Set Row Height depending on cell content...
 
I'm asking if it's possible to determine the number of lines of text in a
cell based on a fixed column width, but not a known text length. - infact,
it's one line of text that is wrapped in the cell, so how many times the text
is wrapped... Hope that makes sense.

"JLGWhiz" wrote:

Are you asking if there is a maximum number of lines that can be entered in a
cell or are you asking if a user can determine the number of lines based on a
fixed column width and a known text length?

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


Trevor Williams

Set Row Height depending on cell content...
 
Thanks JLGWhiz - I want to specify a row's height in increments of 12.75
depending on how many lines of text already exist in the cell. I don't want
to use 'autofit' as the rows become to narrow for what I'm doing.

"JLGWhiz" wrote:

I don't know if this will help, but these are the limits prior to xl2007.

You can enter a row height of 0 (zero) to 409. If the row height is set to
0, the row is hidden. You can enter a column width of 0 (zero) to 255
characters. If the column width is set to 0, the column is hidden.

Generally speaking, the autofit and word wrap functions should set the width
and heigth to accomodate whatever you enter that are within the above
limitations.

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


Tom Ogilvy

Set Row Height depending on cell content...
 
Why not autofit the row and then make adjustments based on the resulting row
height.

But there is no built in attribute to tell you how many lines are in the
cell.

--
Regards,
Tom Ogilvy


"Trevor Williams" wrote:

I'm asking if it's possible to determine the number of lines of text in a
cell based on a fixed column width, but not a known text length. - infact,
it's one line of text that is wrapped in the cell, so how many times the text
is wrapped... Hope that makes sense.

"JLGWhiz" wrote:

Are you asking if there is a maximum number of lines that can be entered in a
cell or are you asking if a user can determine the number of lines based on a
fixed column width and a known text length?

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


Trevor Williams

Set Row Height depending on cell content...
 
Hi Tom

I didn't want to use autofit as the rows become to tight to the text (I want
a bit of white space between the text and the border) - but, if there's no
other way I'll have to use it.

Thanks for the response.

Trevor

"Tom Ogilvy" wrote:

Why not autofit the row and then make adjustments based on the resulting row
height.

But there is no built in attribute to tell you how many lines are in the
cell.

--
Regards,
Tom Ogilvy


"Trevor Williams" wrote:

I'm asking if it's possible to determine the number of lines of text in a
cell based on a fixed column width, but not a known text length. - infact,
it's one line of text that is wrapped in the cell, so how many times the text
is wrapped... Hope that makes sense.

"JLGWhiz" wrote:

Are you asking if there is a maximum number of lines that can be entered in a
cell or are you asking if a user can determine the number of lines based on a
fixed column width and a known text length?

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor


Trevor Williams

Set Row Height depending on cell content...
 
I've just re-read your answer and realised what you mean - If, after autofit,
the row is 12.75 and <22.50 then make the row height 22.50...

I think I can do that - thanks again Tom

T

"Tom Ogilvy" wrote:

Why not autofit the row and then make adjustments based on the resulting row
height.

But there is no built in attribute to tell you how many lines are in the
cell.

--
Regards,
Tom Ogilvy


"Trevor Williams" wrote:

I'm asking if it's possible to determine the number of lines of text in a
cell based on a fixed column width, but not a known text length. - infact,
it's one line of text that is wrapped in the cell, so how many times the text
is wrapped... Hope that makes sense.

"JLGWhiz" wrote:

Are you asking if there is a maximum number of lines that can be entered in a
cell or are you asking if a user can determine the number of lines based on a
fixed column width and a known text length?

"Trevor Williams" wrote:

Hi All

I need to set the row height depending on the number of lines of text
contained in a cell. Cells that contain text have wordwrap on - if there is
only 1 line of text in the cell the row height should be 12.75, 2 lines of
text should be 22.50 and so on.

Is it possible to determine how many lines of text are in a cell?

Thanks

Trevor



All times are GMT +1. The time now is 01:16 PM.

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