Intriguing problem with the " quotation marks.

R

Ron

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
 
J

JE McGimpsey

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top