New Line in code to worksheet cell?

  • Thread starter Thread starter CG Rosén
  • Start date Start date
C

CG Rosén

Good Evening Group,

Is it possible to force a new line by code after each textstring that goes
into
Sheets("Sheet1").Cells(1, 1). This cell is formated as "Wrap Text". The
length
of the textstring is variable. (See code below).

Sheets("Sheet1").Cells(1, 1) = _
Sheets("Sheet2").Cells(1, 1) & " " & Sheets("Sheet2").Cells(1, 2) & " " & _
Sheets("Sheet2").Cells(1, 3) & " " & Sheets("Sheet21").Cells(1, 4) & " " &
_
Sheets("Sheet2").Cells(1, 5) & " " & Sheets("Sheet2").Cells(1, 6)

Grateful for any help.

Brgds

CG Rosén
 
Sheets("Sheet1").Cells(1, 1) = _
Sheets("Sheet2").Cells(1, 1) & chr(10) & _
Sheets("Sheet2").Cells(1, 2) & chr(10) & _
Sheets("Sheet2").Cells(1, 3) & chr(10) & _
Sheets("Sheet2").Cells(1, 4) & chr(10) & _
Sheets("Sheet2").Cells(1, 5) & chr(10) & _
Sheets("Sheet2").Cells(1, 6)
 
Hi CG Rosén

Try

With Sheets("Sheet2")
Sheets("Sheet1").Cells(1, 1).Value = _
.Cells(1, 1).Value & Chr(10) & .Cells(1, 2).Value & Chr(10) & _
.Cells(1, 3).Value & Chr(10) & .Cells(1, 4).Value & Chr(10) & _
.Cells(1, 5).Value & Chr(10) & .Cells(1, 6).Value
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top