View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fourtrax Fourtrax is offline
external usenet poster
 
Posts: 3
Default How to Evaluate formula results in VBA

Hello,

I am trying to add VBA code in Excel to evaluate the results of a Formula in
a specific cell and then to use the result in an If statement.
The macro loops thru each row, and I want to compare the formula result in a
specific cell to see if the result is equal to 0. If the result is equal to 0
then I want to change the value of the cell to a text string.

Here is what I have so far.

Dim intRows As Integer
intRows = Range("C1").CurrentRegion.Rows.Count
'Loop through all rows
For i = 2 To intRows
If Application.Evaluate("AJ & i") = 0 Then
Range("AJ" & i).Value = "USED"
End If

Thanks in advance for your help.

Jeff