+ Reply to Thread
Results 1 to 4 of 4

Wrap Text in a Cell

  1. #1
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346

    Wrap Text in a Cell

    I have a cell for which I have " Wrap Text " enabled so that if the text string is long and cannot be fitted in the first line in the cell, the text wraps and starts on a second line. In my program I want to check if the text string in the cell has wrapped or not. I would love to see a function like IsWrapped ( which I know does not exist ) but I would not mind even to evaluate, knowing the font and width of the column and the length of the string , whether the text has wrapped. But I just don't know how many max characters of a particular font can be accommodated in a given width of a cell without wrapping.

    Ok my real problem is when I use only one cell and have "Wrap Text" enabled EXCEL behaves as expected - wraps to next line if string is long and row height increases automatically to accommodate the second line. But if I have two adjacent cells ( say A1 and B1 ) merged and row height is initially set to accommodate only one line of text, and if I enter string long enough to wrap, the trailing characters go out of the cell and remain invisible as if "wrap text " is not enabled. I expect that the row height would automatically double to accommodate a second line and the trailing characters in the string would move to that line. I have to manually increase the row height to make the second line in the cell visible.
    I assume that this is normal with EXCEL. Therefore I want to increase the row height through VBA code instead of manually. If someone can suggest how to make EXCEL behave the same way with a single cell and merged cells, I don't need the VBA code.
    Please help.

    A V Veerkar
    Last edited by avveerkar; 09-07-2007 at 03:27 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Are you able to use "Center Across Selection" instead of Merge? This would allow you to avoid this problem altogether.

  3. #3
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Quote Originally Posted by Ikaabod
    Are you able to use "Center Across Selection" instead of Merge? This would allow you to avoid this problem altogether.
    My application requires many ( about 30 ) columns visible on the screen at a time. They are therefore small-width columns which is ok with me because the data in each coumn is just about two character long. Top two cells, however, I need to be really wide to accommodate long strings of data. I therefore have to create these cells by merging 30 adjacent cells. Most of the times the length of the string that appears in this wide cell is not long enough so as to cause a wrap. But ocassionally the string is very long and calls for a wrap. I can keep height of these merged cells big enough to accommodate two lines then the wrap would occur normally. But since most of the time my string is small I do not need double-height cell. "Half empty" appearance of a double height cell with only one line of text is not acceptable. I want a single height row which should automatically change to double height only when it is called for ( due to a long string in the cell ). I need to achieve this.

    Thanks

    A V Veerkar
    Last edited by avveerkar; 09-08-2007 at 12:13 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    For the cells that you have "merged" unmerge them. Then select the range that used to be merged and do as the attached picture shows. This should keep your row at the appropriate height at all times.
    Attached Images Attached Images

+ 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