ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Count only Colored cells (https://www.excelbanter.com/excel-programming/348933-how-count-only-colored-cells.html)

WM_1956

How to Count only Colored cells
 

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

Thanks for any help...
Wm_195

--
WM_195
-----------------------------------------------------------------------
WM_1956's Profile: http://www.excelforum.com/member.php...fo&userid=2989
View this thread: http://www.excelforum.com/showthread.php?threadid=49603


Gary''s Student

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



jtp

How to Count only Colored cells
 

Hi WM,
You need to be a little more specific. Are performing a differen
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 an
colored cell in column A. I am also assuming that you have data i
these cells. If not, the For loop will have to be changed as it wil
not pick up the upper limit.

If you are completely new to Excel and do not know how/where to pu
your VBA code, take a look at this site... Found this from a thread b
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 ha
colored cells showing when a project is completed. My problem is I nee
to do a "count" on the completed(colored cells). How can I do this

--
jt
-----------------------------------------------------------------------
jtp's Profile: http://www.excelforum.com/member.php...fo&userid=2113
View this thread: http://www.excelforum.com/showthread.php?threadid=49603



All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com