![]() |
Using Text in a Formula or FormulaR1C1 property
I want to use a logical if statement checking a text word in a formula
statement. I want programmatically to create the cell =IF(A1="apples","Yes","No") However, when I enter Range("B1").Formula="=IF(A1="apples","Yes","No")" in VB the quotes mess this all up. The single quotes don't work either Range("B1").Formula="=IF(A1='apples','Yes','No')" Any ideas? |
Using Text in a Formula or FormulaR1C1 property
Double up the double quotes:
Sub dural() s = "=IF(A1=""apples"", ""yes"",""no"")" Range("B1").Formula = s End Sub -- Gary''s Student - gsnu200840 "Turtle_Todd" wrote: I want to use a logical if statement checking a text word in a formula statement. I want programmatically to create the cell =IF(A1="apples","Yes","No") However, when I enter Range("B1").Formula="=IF(A1="apples","Yes","No")" in VB the quotes mess this all up. The single quotes don't work either Range("B1").Formula="=IF(A1='apples','Yes','No')" Any ideas? |
Using Text in a Formula or FormulaR1C1 property
Dim strTemp
Dim strValue strValue = "Apple" strTemp = "=IF(A1=""" & strValue & """,""yes"",""no"")" Range("B1").Formula = strTemp If this post helps click Yes -------------- Jacob Skaria |
Using Text in a Formula or FormulaR1C1 property
works great, thanks
"Gary''s Student" wrote: Double up the double quotes: Sub dural() s = "=IF(A1=""apples"", ""yes"",""no"")" Range("B1").Formula = s End Sub -- Gary''s Student - gsnu200840 "Turtle_Todd" wrote: I want to use a logical if statement checking a text word in a formula statement. I want programmatically to create the cell =IF(A1="apples","Yes","No") However, when I enter Range("B1").Formula="=IF(A1="apples","Yes","No")" in VB the quotes mess this all up. The single quotes don't work either Range("B1").Formula="=IF(A1='apples','Yes','No')" Any ideas? |
All times are GMT +1. The time now is 04:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com