How can I do this

S

sa3214

I wish to concatenate two cells containing text but include a CRLF between
the two parts of the result ... to give the same effect as using ALT +Enter
when entering the data directly.

If is this possible using vba ?
If so how is it achieved ?

Regards and TIA
 
N

Norman Jones

Hi sa3214,

Sub Tester()
Range("A1").Value = "Apple"
Range("B1").Value = "pie"
Range("C1") = Range("A1").Value & vbLf & Range("B1").Value

End Sub
 
R

Rob Bovey

You can just insert a line feed character at the point where you want
the text to wrap. Here's an example:

Sheet1.Range("A3").Value = _
Sheet1.Range("A1").Value & vbLf & _
Sheet1.Range("A2").Value

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Top