ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Question (insert new line) (https://www.excelbanter.com/excel-programming/335653-simple-question-insert-new-line.html)

Joe D[_4_]

Simple Question (insert new line)
 
Currently I have code that looks something like this:

thisCell.Value = thisCell.Value & " " & newCell.Value

Which adds the new value to the old value, separated by a space.
However, I would rather have this line of code insert a line break. In
the formula bar, CHAR(10) works for this, but I tried to just replace
the space(" ") with CHAR(10) and Excel complains about it. What is the
correct way to insert a line break?

Thanks to anyone who responds,
Joe


Tom Ogilvy

Simple Question (insert new line)
 
thisCell.Value = thisCell.Value & chr(10) & newCell.Value

in VBA, it is CHR, not CHAR

--
Regards,
Tom Ogilvy


"Joe D" wrote in message
oups.com...
Currently I have code that looks something like this:

thisCell.Value = thisCell.Value & " " & newCell.Value

Which adds the new value to the old value, separated by a space.
However, I would rather have this line of code insert a line break. In
the formula bar, CHAR(10) works for this, but I tried to just replace
the space(" ") with CHAR(10) and Excel complains about it. What is the
correct way to insert a line break?

Thanks to anyone who responds,
Joe




Bob Phillips[_6_]

Simple Question (insert new line)
 
thisCell.Value = thisCell.Value & Chr(10) & newCell.Value


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Joe D" wrote in message
oups.com...
Currently I have code that looks something like this:

thisCell.Value = thisCell.Value & " " & newCell.Value

Which adds the new value to the old value, separated by a space.
However, I would rather have this line of code insert a line break. In
the formula bar, CHAR(10) works for this, but I tried to just replace
the space(" ") with CHAR(10) and Excel complains about it. What is the
correct way to insert a line break?

Thanks to anyone who responds,
Joe




Joe D[_4_]

Simple Question (insert new line)
 
Thanks Tom



All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com