Results 1 to 4 of 4

How to count PASS/FAIL cells in a range...

Threaded View

  1. #1
    Registered User
    Join Date
    08-04-2010
    Location
    CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    How to count PASS/FAIL cells in a range...

    Hi. I have a test log with PASS/FAIL. These results are logged in Excel under the column heading PASS/FAIL.
    How do I count the number of PASS or FAIL using VBA macro?

    So far I have tried:
    Sub PASS_FAIL_COUNT()
    
        Dim count As Integer
        Dim name As String
        count = 0
        Do
            count = count + 1
            name = Range("PASS/FAIL").Select                    
        Loop Until (name <> "PASS" Or name <> "FAIL")
    End Sub
    This one did not work either:
    Sub PASS_FAIL_COUNT()
    
        Dim r As Range
        Dim cell_count As Integer
        Dim name As String
        cell_count = 0
        Do
            Set r = Range("PASS/FAIL").Select
            name = r.Cells(1, r.Columns.count).Select
            If (name = "PASS" Or name = "FAIL") Then
                cell_count = cell_count + 1
            End If
        Loop Until (name <> "PASS" Or name <> "FAIL")
    End Sub
    the error is at the name = Range("PASS/FAIL").Select line.

    My thought process: once I had selected a range, I can now freely "look" at each string in a cell in that range. Not correct I guess.

    Please advice. thank you.

    p.s. all this is currently done in the active sheet.
    Last edited by dtvonly; 05-12-2014 at 11:49 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to make a cell display "FAIL" when range of cells is FAIL
    By crazychile in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-18-2017, 04:13 PM
  2. [SOLVED] Need a formula for pass/fail based on no. of Y answers but automatically fail if 3a is N
    By Researcher1111 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-15-2013, 10:20 PM
  3. Replies: 5
    Last Post: 03-16-2010, 07:05 AM
  4. Replies: 13
    Last Post: 09-29-2008, 10:36 AM
  5. [SOLVED] Macro for test result Count as pass, fail and incomplete.
    By Amar in forum Excel General
    Replies: 1
    Last Post: 06-10-2005, 08:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1