

=”Value in cell A1 is ” & A1 & CHAR(10) & “Value in cell A2 is ” & A2 Here’s an example formula as entered into excel: The problem comes when I try to copy & paste the data from a cell with the linebreak character into a text file (with notepad or any text editor like ultraedit) However, I often use Excel to generate code for use in languages such as lua and python. I found your little tutorial here very useful when I’m working with worksheets.

Merged cells are a pain in the butt to work with, but it can’t be avoided in this case. The issue concerns users entering text into a *merged* cell, and the need to automatically adjust the height of the row if wrapping occurs. Other than using VBA event triggers (which I can do, but my wife won’t understand), I don’t suppose there is a “passive” method for changing the row height predicated on user input. If, on the other hand, the line feeds are entered in during the creation of a formula (like your example), then Excel, upon hitting the enter key, does change the state of itself and modify the row height to meet the needs of the formula. This is consistent with Excel’s behavior of not having a worksheet function change the state of Excel, but simply return a value.

The problem with embedding these characters (line feeds) inside of a formula is that after the formula is entered, when the formula is triggered to insert the line feeds (and thus change the row height accordingly), nothing happens. Dick: I tried to solve a text wrap problem my wife was having by embedding several “CHAR(10)” characters inside of an “IF” formula, in order to create a pseudo “autofit” kind of situation for end users.
