ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   quotation marks in string (https://www.excelbanter.com/excel-programming/378524-re-quotation-marks-string.html)

Simon Lloyd[_898_]

quotation marks in string
 

Robin;6985201 Wrote:
Hi. I am trying to create a string variable that will include quotation
marks
but am struggling. The line of code is in a loop and changes as the
loops are
completed. Line of code is as follows:
cell1 = "=one 1"
If m 0 Then cell1 = """ & cell1 & """ & "&char(10)&" & """ &
Range("D2").Offset(m, 0) & """
The char(10) is a carriage-return to put the new text on a new line.
If the new cell1 is 'two 2', then I want cell1 to become ="one
1"&char(10)&"two 2"
BUT, the quotation marks are giving me problems. Any ideas how I can
get
around this?

When using the amperand (&) type this after it Chr(34), this will give
you one quote for a set of two it would look like
Code:
--------------------
& Chr(34) & Chr(34) &
--------------------
Regards,
Simon


--
Simon Lloyd


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

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