Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Capturing "text" instead of the formula
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I write an excel formula with a text answer ("yes" or "no") | Excel Discussion (Misc queries) | |||
Formating numbers &"Text" to appear as currency &"Text" in formula | Excel Discussion (Misc queries) | |||
If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ... | Excel Programming | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) | |||
How do I split "A1B2" into "A1" and "B2" using text to column fun. | Excel Programming |