View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dawg House Inc Dawg House Inc is offline
external usenet poster
 
Posts: 22
Default Using Quotation Marks in Arguments

Thanks Tom. While that is very obvious, I stupidly tried """ instead of """".
Thanks for your help. You guys are always there when I need it :-)
--
Dawg House Inc.
"We live in it, therefore, we know it!"


"Tom Ogilvy" wrote:

Worksheets("S1").Range("C3").Value = "=IF(South!G16 = """", """",
South!G16)"
Worksheets("S1").Range("C5").Value = "=IF(MidWest!G16 = """", """",
MidWest!G16)"
Worksheets("S1").Range("C7").Value = "=IF(West!G16 = """", """", West!G16)"


Often good to test in the immediate window:

? "=IF(West!G16 = """", """", West!G16)"
=IF(West!G16 = "", "", West!G16)

you need to double up on double quotes interior to a string.

--
Regards,
Tom Ogilvy

"Dawg House Inc" wrote in message
...
I have three option buttons, and pending on which one is selected, I need

to
update three related cells with the appropriate formula. I have this
currently, but its not working properly:

Worksheets("S1").Range("C3").Value = "=IF(South!G16 = "", "", South!G16)"
Worksheets("S1").Range("C5").Value = "=IF(MidWest!G16 = "", "",

MidWest!G16)"
Worksheets("S1").Range("C7").Value = "=IF(West!G16 = "", "", West!G16)"

This results in the formula in the cell ending up like this:
=IF(South!G16 = ", ", South!G16)
=IF(MidWest!G16 = ", ", MidWest!G16)
=IF(West!G16 = ", ", West!G16)

I WANT the result to be this:
=IF(South!G16 = "", "", South!G16)
=IF(MidWest!G16 = "", "", MidWest!G16)
=IF(West!G16 = "", "", West!G16)

Any suggestions would be greatly appreciated.
--
Dawg House Inc.
"We live in it, therefore, we know it!"