ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Intriguing problem with the " quotation marks. (https://www.excelbanter.com/excel-programming/355957-intriguing-problem-quotation-marks.html)

Ron[_32_]

Intriguing problem with the " quotation marks.
 
Hi Guys,

I'm trying to write a bit of simple code to make my cell (text string)
values be surrounded by "Quotes"

What I want is... Forename Surname to be enclosed by quotes, like this
"Forename Surname"

But, after trying myriad ways to get it with code I'm stuck. I've searched
the newsgroup and found a few posts regarding double quotes, which I
already knew.

ActiveCell.Offset(0, 2).Value = """ & ActiveCell.Value & """

This displays in the cell as "" & ActiveCell.Value & ""

But I need it to display as "Forename Surname" where Forename Surname is
the contents of the active cell.

I've tried all manner of combinations but no luck. I even thought of
trying to insert a filler character (say X) and then have a bit more code
remove the X's.

Is there a simpler way?

Thanks guys,

Ron

davesexcel[_64_]

Intriguing problem with the " quotation marks.
 

You have triple quotes, it should only be double quotes


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=522143


JE McGimpsey

Intriguing problem with the " quotation marks.
 
Quote marks need to be doubled (then enclosed within a pair of quote
marks):

ActiveCell.Offset(0, 2).Value = """" & ActiveCell.Value & """"

Alternatively

ActiveCell.Offset(0, 2).Value = Chr(34) & ActiveCell.Value & Chr(34)


In article ,
Ron wrote:

Hi Guys,

I'm trying to write a bit of simple code to make my cell (text string)
values be surrounded by "Quotes"

What I want is... Forename Surname to be enclosed by quotes, like this
"Forename Surname"

But, after trying myriad ways to get it with code I'm stuck. I've searched
the newsgroup and found a few posts regarding double quotes, which I
already knew.

ActiveCell.Offset(0, 2).Value = """ & ActiveCell.Value & """

This displays in the cell as "" & ActiveCell.Value & ""

But I need it to display as "Forename Surname" where Forename Surname is
the contents of the active cell.

I've tried all manner of combinations but no luck. I even thought of
trying to insert a filler character (say X) and then have a bit more code
remove the X's.

Is there a simpler way?

Thanks guys,

Ron


Ron[_32_]

Intriguing problem with the " quotation marks.
 
Hi Guys,

Many thanks for the swift reply.

I am indeed sorted now.


Ron


All times are GMT +1. The time now is 10:24 PM.

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