View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Quote Marks Through VBA

I responded in the style of the question, therefore triple is not needed, it
will either be placed into a variable, in which case it will need enclosing
within quotation marks, or it will be a property value in-line, in which
case it would also be enclosed within quotation marks.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Doubling quotes is not sufficient. You need to triple them. Or am I
missing something?

=IF(Sheet2!G6="""Maturity""",1,2)

The way I see it is this. The 1st quote just begins the quote
sequence. The second quote would normally end it, but since it is
followed by a quote, it is interpreted as a "hard" quote instead. Then
the fourth quote would normally end it, but it too is followed by a
quote so it is made hard, and the then 6th quote just ends the whole
shebang.

Dom



Bob Phillips wrote:
=IF(Sheet2!G6=""Maturity"",1,2)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Very simple question, but I can't figure it out:

I want to make a formula in a cell through VBA, but I want the formula
to have a word in it (which needs to be in quotes). That is, I want
the formula to read:

=IF(Sheet2!G6="Maturity",1,2)

How can I get the Maturity part surrounded by quotes?

Thanks!

Brett