Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to determine whether text in cell needs to be wrapped?

Hello -

I want to determine whether a string will fit into a column or now
(i.e. whether it needs to be wrapped or not). I looked at the WrapText
property but that is only set when the cell is actually wrapped.

Is there a way to determine a "wrap necessary" or "will be wrapped"
status? I could probably count the number of characters and make a
guestimate on the maximum number of characters that will fit into a
specified column witdh ... just not the best solution ...

Any ideas?

Thanks,
Joe

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default How to determine whether text in cell needs to be wrapped?

If you set cell formatting to wrap text, the wrapping will be done
automatically. Does wrapped text affect something else you need to do?

The following works in Excel 2003. When run, it uses the .RowHeight
property to display a dialog box with the height of cell A1. When I
set formatting in A1 to Wrap Text, the height changed when the text was
long enough to cause wrapping.

Dim x As Integer

Sub doathing()
x = Cells(1, 1).RowHeight
MsgBox (x)
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to determine whether text in cell needs to be wrapped?

Hello -

That worked! I check the RowHeight before I set the value (with
WrapText = True) and then I check the RowHeight after I set the value
and check whether it is larger.

Thanks!
Joe

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default How to determine whether text in cell needs to be wrapped?

Glad to help. Thanks for the feedback.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not all wrapped text in an Excell cell is printed. Why not? Monique Excel Discussion (Misc queries) 4 June 28th 06 12:47 PM
wrapped text cell Magyvr Excel Discussion (Misc queries) 2 May 3rd 06 09:31 PM
Cell data not visible (I have wrapped text & resized) Toni D Excel Worksheet Functions 2 March 15th 06 01:56 PM
In Excel formatted wrapped text displays as xxx in cell Linda Excel Discussion (Misc queries) 1 January 26th 06 06:53 PM
Unwanted blank line in cell with wrapped text bbl Excel Discussion (Misc queries) 2 February 11th 05 09:29 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"