Capturing "text" instead of the formula
Hi,
Try this
Dim Pass As Long, i As Long
Dim Fail As Long, ZeroRow As Long
Pass = 0
Fail = 0
For i = 9 To (ZeroRow - 3) Step 8
If UCase(Cells(i, "H").Value) = "PASS" Then
Pass = Pass + 1
Else
Fail = Fail + 1
End If
Next
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"Bishop" wrote:
I have the following code snippet:
Pass = 0
Fail = 0
For i = 9 To (ZeroRow - 3) Step 8
If Cells(i, "H").Value = Pass Then
Pass = Pass + 1
Else
Fail = Fail + 1
End If
Next
The cells I'm referring to actually have formulas in them but when you look
at the worksheet the cells have either "Pass" or "Fail" in them. That's what
I'm trying to capture. But when I run this code it doesn't see "Pass" in any
of the cells so all of them in the for loop get assigned to Fail. I've tried
putting the word Pass in quotes:
If Cells(i, "H").Value = "Pass" Then
but that doesn't work either. How can I fix this?
|