View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Writing an IF/Then Statement in VB based on entry in a cell

Range("K" & i).Activate
ActiveCell.FormulaR1C1 = _
"=((YEAR(RC[-1])-YEAR(RC[-2]))*12)+(MONTH(RC[-1])-MONTH(RC[-2]))"
ActiveCell.Value 0 Then
'do something
Else
'do something else
End If


Hutch
--------------------------------
"Barb Reinhardt" wrote:

I have defined the following value for a cell within my macro

Range("K" & i).Select
ActiveCell.FormulaR1C1 = _
"=((YEAR(RC[-1])-YEAR(RC[-2]))*12)+(MONTH(RC[-1])-MONTH(RC[-2]))"

If the value of this range is 0, I want to do other things. I'm not sure
how to write an "IF" statement to capture this information. How do I do
that?

Thanks in advance,
Barb Reinhardt