Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default New Line in code to worksheet cell?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default New Line in code to worksheet cell?

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)

--
Regards,
Tom Ogilvy

"CG Rosén" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default New Line in code to worksheet cell?

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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"CG Rosén" wrote in message ...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
Copy a cell from another worksheet and create a line wrap Vic Excel Discussion (Misc queries) 1 April 9th 09 01:55 PM
How to extract zip code from a 1 cell adress line? Tippo22 Excel Discussion (Misc queries) 2 June 4th 08 07:39 AM
New Line Code for Cell Format C Brandt Excel Discussion (Misc queries) 2 June 25th 07 05:54 PM
How to insert line on other worksheet depending upon result in cell? Pheasant Plucker® Excel Discussion (Misc queries) 4 March 17th 06 09:05 AM


All times are GMT +1. The time now is 12:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"