ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Quotation Marks in Arguments (https://www.excelbanter.com/excel-programming/358410-re-using-quotation-marks-arguments.html)

Tom Ogilvy

Using Quotation Marks in Arguments
 
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!"




Dawg House Inc

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!"






All times are GMT +1. The time now is 05:22 PM.

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