Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim strTemp
Dim strValue strValue = "Apple" strTemp = "=IF(A1=""" & strValue & """,""yes"",""no"")" Range("B1").Formula = strTemp If this post helps click Yes -------------- Jacob Skaria |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to refer to the .text property without text box name? | Excel Programming | |||
FormulaR1C1 v Formula | Excel Programming | |||
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit | Excel Programming | |||
Need help with FORMULAR1C1 property | Excel Programming | |||
Value Property vs Text property | Excel Programming |