Is that possible to collapse the cell with long text?

Raincool

New Member
Joined
Mar 7, 2012
Messages
46
I have an excel worksheet, there is a cell for my log content in one sheet.
As the log content goes longer and longer... then it is very difficult to manage this kind of sheet with high cells...

Wonder if it is possible to collapse this log cell?
Or any other way to solve that?

Found an instruction from wikihow.. 3 Ways to Truncate Text in Excel - wikiHow
but it doesn't remove the defined range from the original cell, it just copies the defined character in the cell with left/right formula.

May anyone help me here?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Raincool,

Could you clarify what you mean by "collapse this log cell"?
Are you wanting to keep the entire content in the cell but limit the height of the cell?
You could do that by applying a fixed height to the cell's row or not using word wrap.

If you're wanting to toggle back and forth between displaying the entire text, and displaying just 1 line, there are some VBA approaches to do that.
 
Last edited:
Upvote 0
Hi Jerry
Sorry for not being clear in my original text.
But to be honest, i don't know how shall i describe it.

Yes, I want to limit the cell height, but on the other way, I also would like to see the whole content under the cell when I need to check the details.
And I must use the word wrap function. as first, this cell cannot be too long, and second, I need to enter new log data in different text row under the cell.
The log content under this cell is like this:
===========================
2013-09-01: XXXXXX
2013-09-02: YYYYYYYYYYY
2013-09-03: ZZZZZZZZZZZZZZZZ
ZZZZZZZZZZ
2013-09-04: AAAAAAAAAAAAA
==========================
If any good solution for it?
 
Upvote 0
Here's a relatively simple VBA event code that allows you to double-click on a cell to toggle between a fixed-height row and an autofit row.

Copy this code into the ThisWorkbook module of your workbook.

Code:
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
        ByVal Target As Range, Cancel As Boolean)
'--toggles double-clicked cell's row height between autofit and fixed height

    '--modify to default height of collapsed row.
    '     this needs to be a row height increment that Excel can store
    '     eg Excel converts 12.73 to 12.75 so 12.73 should not be used.

    
    Const dCollapsedHeight = 12.75

    
    Cancel = True

    
    With Target.EntireRow
        If .RowHeight = dCollapsedHeight Then
        '--expand
            .AutoFit
        Else
        '--collapse
            .RowHeight = dCollapsedHeight
        End If
    End With
End Sub

You also might try the code from this thread.
http://www.mrexcel.com/forum/excel-...y-causing-scrolling-problems.html#post3220654

For this approach, you set all your rows to be collapsed with a fixed height.
When you double-click the cell, it doesn't change the row height but instead adds a Comment box that displays all the text in that cell.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top