how to find out if text in the Excel cell will be trancated?

V

Viktor

Hi everybody,

Is there a way to find out if the text in the cell will not be
displayed completely (for inst., if text in A1 is 100 characters long,
it is going to be displayed in full only if the columns B1, C1, D1 etc
are empty, but if they are not, the text will not be displayed in
full).

I would like to know if there is a way to find out if the text is
going to be trancated without knowing if the neighbouring cells
contain anything.

Thank you!

Viktor
 
T

Tom Ogilvy

inexact, but the

if len(Range("A1")) > Range("A1").ColumnWidth then
msgbox "Possiblity text is wider than column"
End if

Columnwidth is measured units of character width:

One unit of column width is equal to the width of one character in the
Normal style. For proportional fonts, the width of the character 0 (zero) is
used.

Regards,

Tom Ogilvy
 
V

Viktor

Hi Tom,
Thanks a lot for your reply. However, it does not solve my problem. I
know how to figure out if the text is larger then the column, but that
does not mean that it will be trancated: if, say, the next couple of
columns are empty, it will be displayed in full. How can I know if the
text is going to be trancated without checking if there is anything in
B1 or C1?

Of course, I can loop through columns (B1, C1, D1 etc) to see if they
are empty and if not, see if their total width is more then the text
width in A1, but that would mean a lot of extra processing.

What I was hoping for, is that there is some kind of a property for a
text in A1 that would indicated if A1 text is going to be trancated
because there is some data in, say D1 and the text in A1 is longer
then (A1+B1+C1) so it will not be displayed in full.

I hope this explenation is clear.

Thanks everyone.

Viktor
 

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