+ Reply to Thread
Results 1 to 3 of 3

How to Count only Colored cells

  1. #1
    Registered User
    Join Date
    12-26-2005
    Posts
    1

    How to Count only Colored cells

    I'm new to Excel, but I've been asked to create a worksheet that has colored cells showing when a project is completed. My problem is I need to do a "count" on the completed(colored cells). How can I do this?

    Thanks for any help...
    Wm_1956

  2. #2
    Gary''s Student
    Guest

    RE: How to Count only Colored cells

    See:

    http://www.xldynamic.com/source/xld.ColourCounter.html


    --
    Gary''s Student


    "WM_1956" wrote:

    >
    > I'm new to Excel, but I've been asked to create a worksheet that has
    > colored cells showing when a project is completed. My problem is I
    > need to do a "count" on the completed(colored cells). How can I do
    > this?
    >
    > Thanks for any help...
    > Wm_1956
    >
    >
    > --
    > WM_1956
    > ------------------------------------------------------------------------
    > WM_1956's Profile: http://www.excelforum.com/member.php...o&userid=29895
    > View this thread: http://www.excelforum.com/showthread...hreadid=496032
    >
    >


  3. #3
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    Hi WM,
    You need to be a little more specific. Are performing a different count on each color or just any color? Also are you going by just row, column or an entire worksheet? The procedure below will count any colored cell in column A. I am also assuming that you have data in these cells. If not, the For loop will have to be changed as it will not pick up the upper limit.

    If you are completely new to Excel and do not know how/where to put your VBA code, take a look at this site... Found this from a thread by Norman Jones

    David McRitchie's 'Getting Started With Macros And
    User Defined Functions' at:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm


    You might also look at David's tutorials page at:

    http://www.mvps.org/dmcritchie/excel....htm#tutorials

    The VBA material is towards the end of that section.

    Sub CountColoredCells()
    Dim cell As Range, i As Integer, totals As Integer

    Set cell = Range("A1")

    totals = 0
    For i = 0 To Range("A1").End(xlDown).Row - 1
    If cell.Offset(i, 0).Interior.ColorIndex <> xlNone Then
    totals = totals + 1
    End If
    Next
    cell.Offset(i, 0).Value = totals

    End Sub

    Hope this helps some,

    Jason


    I'm new to Excel, but I've been asked to create a worksheet that has colored cells showing when a project is completed. My problem is I need to do a "count" on the completed(colored cells). How can I do this?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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