Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions User Defined > COLOURCOUNT< Previous | Next > 

 

COLOURCOUNT(rgeColouredCells, iColourIndex)

 
 

Returns the number of cells that contain a particular colour.

 

 
rgeColouredCellsThe range of cells you want to check.
iColourIndex 
 

 

REMARKS

 
 
  • ??

     

     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    Option Explicit

    Public Function COLOURCOUNT(ByVal rgeColouredCells As Range, _
                                ByVal iColourIndex As Integer) As Integer

       Dim rgeCell As Range
       For Each rgeCell in rgeColouredCells
          If rgeCell.Interior.ColorIndex = iColourIndex Then
             COLOURCOUNT = COLOURCOUNT + 1
          End If
       Next rgeCell
    End Function
       

     

    Example

     


     Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >