Telle nr. av celle med bestemt farge i en rad / kolonne

Her definerer jeg en funksjon for å telle et nei. av celle i en rad / kolonne med bestemt farge,

Det er akkurat som Countif cellcolor er = Farge

 Funksjon ColorCount (colorCell As Range, countRange As Range) Dim rCell Som Range Dim CellCol Som Integer Dim ans Så lenge ans = 0 cellCol = colorCell.Interior.ColorIndex For hver rCell I countRange Hvis rCell.Interior.ColorIndex = cellCol Så ans = ans + 1 End Hvis neste rCell ColorCount = ans End Function 
Forrige Artikkel Neste Artikkel

Beste Tips