Is it possible to take only the first two lines from a wrapped text cell through VBA code?
For example, a wrapped text cell has value as:
aaaaaaa
bbbbbbb
ccccccc
ddddddd
So the cell contains 4 lines of wrapped text. I need to extract
"aaaaaaaa
bbbbbbbb"
With your text in A1, you can try this formula to extract the first two lines:
You can use
=SUBSTITUTE(...,CHAR(10)," ")to replace line breaks with spaces.If you want to use VBA, you could use: