Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write an excel formula with a text answer ("yes" or "no") pat Excel Discussion (Misc queries) 1 September 9th 08 03:41 PM
Formating numbers &"Text" to appear as currency &"Text" in formula Robin K. Excel Discussion (Misc queries) 6 May 7th 07 02:03 PM
If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ... Maria J-son[_2_] Excel Programming 2 March 5th 06 12:20 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"