Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to insert line-feed in Excel concatenation (VB)

I want to concatenate values from multiple cells into one cell. I want a
line-feed separating the values in the combined cell. I tried using the
ASCII character code (10 for linefeed, 13 for carriage return), but its not
working the way I did it.

Any help is greatly appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Need to insert line-feed in Excel concatenation (VB)

="a"&CHAR(10)&"b"

FormatcellsAlignment, check Wrap text

--
Kind regards,

Niek Otten

"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell. I want a
line-feed separating the values in the combined cell. I tried using the
ASCII character code (10 for linefeed, 13 for carriage return), but its
not
working the way I did it.

Any help is greatly appreciated.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Need to insert line-feed in Excel concatenation (VB)

Susan,

Try something like

=A1&CHAR(10)&A2

or, in VBA

Range("B1").Value = Range("A1").Value & Chr(10) &
Range("A2").Value

Ensure that the cell has Wrap Text enabled (Format menu, Cells,
Alignment tab).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell.
I want a
line-feed separating the values in the combined cell. I tried
using the
ASCII character code (10 for linefeed, 13 for carriage return),
but its not
working the way I did it.

Any help is greatly appreciated.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to insert line-feed in Excel concatenation (VB)

Yes - the Chr(10) did it. Thanks very much!
Susan

"Chip Pearson" wrote:

Susan,

Try something like

=A1&CHAR(10)&A2

or, in VBA

Range("B1").Value = Range("A1").Value & Chr(10) &
Range("A2").Value

Ensure that the cell has Wrap Text enabled (Format menu, Cells,
Alignment tab).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell.
I want a
line-feed separating the values in the combined cell. I tried
using the
ASCII character code (10 for linefeed, 13 for carriage return),
but its not
working the way I did it.

Any help is greatly appreciated.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need to insert line-feed in Excel concatenation (VB)

I find that using vbLF is a bit more readible and is certainly faster to type
than CHR(10). Am I missing something here?

"Susan W" wrote:

Yes - the Chr(10) did it. Thanks very much!
Susan

"Chip Pearson" wrote:

Susan,

Try something like

=A1&CHAR(10)&A2

or, in VBA

Range("B1").Value = Range("A1").Value & Chr(10) &
Range("A2").Value

Ensure that the cell has Wrap Text enabled (Format menu, Cells,
Alignment tab).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell.
I want a
line-feed separating the values in the combined cell. I tried
using the
ASCII character code (10 for linefeed, 13 for carriage return),
but its not
working the way I did it.

Any help is greatly appreciated.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Need to insert line-feed in Excel concatenation (VB)

vbLF, vbCR etc are certianly more clear to read, but have exactly the same
effect as Chr(10), Chr(13).
The only one that may make a difference is vbNewLine, which will give the
correct value on a PC or Mac.

NickHK

"scabHead" wrote in message
...
I find that using vbLF is a bit more readible and is certainly faster to

type
than CHR(10). Am I missing something here?

"Susan W" wrote:

Yes - the Chr(10) did it. Thanks very much!
Susan

"Chip Pearson" wrote:

Susan,

Try something like

=A1&CHAR(10)&A2

or, in VBA

Range("B1").Value = Range("A1").Value & Chr(10) &
Range("A2").Value

Ensure that the cell has Wrap Text enabled (Format menu, Cells,
Alignment tab).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell.
I want a
line-feed separating the values in the combined cell. I tried
using the
ASCII character code (10 for linefeed, 13 for carriage return),
but its not
working the way I did it.

Any help is greatly appreciated.







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Need to insert line-feed in Excel concatenation (VB)

Hi Mr.Pearson,

a1&char(10)&a2 works well, but how to make the containing cell collapse
automatically when it contains multiple lines

Clara
--
thank you so much for your help


"Chip Pearson" wrote:

Susan,

Try something like

=A1&CHAR(10)&A2

or, in VBA

Range("B1").Value = Range("A1").Value & Chr(10) &
Range("A2").Value

Ensure that the cell has Wrap Text enabled (Format menu, Cells,
Alignment tab).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Susan W" <Susan wrote in message
...
I want to concatenate values from multiple cells into one cell.
I want a
line-feed separating the values in the combined cell. I tried
using the
ASCII character code (10 for linefeed, 13 for carriage return),
but its not
working the way I did it.

Any help is greatly appreciated.





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
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
How do I insert a line feed in a formula? TX_KniveS Excel Worksheet Functions 5 October 31st 08 12:55 AM
How can I insert a line feed in the text in an EXCEL cell? Antionio Excel Discussion (Misc queries) 2 February 15th 06 10:59 AM
Find/Replace carriage return & line feed characters in Excel. Mary Cullen Excel Worksheet Functions 1 January 4th 05 07:39 PM
how does excel store new line and line feed characters? ben h[_2_] Excel Programming 0 July 1st 04 02:34 AM


All times are GMT +1. The time now is 01:42 AM.

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

About Us

"It's about Microsoft Excel"