+ Reply to Thread
Results 1 to 4 of 4

How to determine whether text in cell needs to be wrapped?

Hybrid View

Guest How to determine whether text... 05-24-2006, 05:45 PM
Guest Re: How to determine whether... 05-24-2006, 06:30 PM
Guest Re: How to determine whether... 05-25-2006, 06:10 AM
Guest Re: How to determine whether... 05-25-2006, 03:35 PM
  1. #1
    Joe HM
    Guest

    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. #2
    Mark Lincoln
    Guest

    Re: 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. #3
    Joe HM
    Guest

    Re: 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. #4
    Mark Lincoln
    Guest

    Re: How to determine whether text in cell needs to be wrapped?

    Glad to help. Thanks for the feedback.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1