View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Quote Marks Through VBA

Just an idea. Some like to use a custom function for the quotes.
A function named "Q" seems to be popular. (another might QQ for Double
quotes)

[A1] = "=IF(Sheet2!G6=" & Q("Maturity") & ",1,2)"

Sometimes this can help if the equation is complicated.
--
HTH :)
Dana DeLouis
Windows XP & Office 2003


wrote in message
ps.com...
Thanks! That works - is there a place I can see all the character code
numbers?

Gary''s Student wrote:
I put them in explicitly thru chr():


Sub brett()
Dim s As String
s = "=IF(Sheet2!G6=" & Chr(34) & "Maturity" & Chr(34) & ",1,2)"
Cells(1, 1).Formula = s
End Sub

--
Gary's Student


" wrote:

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