It rather depends on (a) you want the answer to change if
the data changes ie you want the formula in the cell, or
(b) you want VBA to enter the result
In the example, rw and cl are lomg and represent the
address of the cell to be tested. "B5" then is rw=5, cl=2
and the answer is placed one column to the right
(a) place a formula:-
Cells(rw, cl + 1).FormulaR1C1 = _
"=IF(RC[-1]=0,""Yes"","""")"
(b) use VBA to set the answer:-
If Cells(rw, cl).Value = 0 Then
Cells(rw, cl + 1) = "Yes"
End If
Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
I would like to use the IF Formula to check the contents
of a cell and
place a "Yes" if true or nothing if False. The standard
formula of IF
(A27=0,"Yes","") doesn't work in VBA because of the
quotation marks for
some reason. How do I do it?
Also, I would like to counter the rows by 14 and place
the result in a
column. In other words, check A27 and place the result
in H1 on
Sheet3. Then check A41 and place the result in H2 and
so on. Thanks.
Tom - you've been a huge help!! I unfortunately learn
by example - I
wish there was a site or reference materials available
that catered to
the very beginner! Thanks again!!
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from
http://www.ExcelForum.com/
.