![]() |
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 |
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 |
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 |
How to determine whether text in cell needs to be wrapped?
Glad to help. Thanks for the feedback.
|
All times are GMT +1. The time now is 07:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com