Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have some code that counts cells with specific color, now I also want to count all cells with diagonal borders. The cell color count VBA is below... Function CellColorIndex(InRange As Range, Optional _ OfText As Boolean = False) As Integer ' ' This function returns the ColorIndex value of a the Interior ' (background) of a cell, or, if OfText is true, of the Font in the cell. ' Application.Volatile True If OfText = True Then CellColorIndex = InRange(1, 1).Font.ColorIndex Else CellColorIndex = InRange(1, 1).Interior.ColorIndex End If End Function Function CountByColor(InRange As Range, _ WhatColorIndex As Integer, _ Optional OfText As Boolean = False) As Long ' ' This function return the number of cells in InRange with ' a background color, or if OfText is True a font color, ' equal to WhatColorIndex. ' Dim Rng As Range Application.Volatile True For Each Rng In InRange.Cells If OfText = True Then CountByColor = CountByColor - _ (Rng.Font.ColorIndex = WhatColorIndex) Else CountByColor = CountByColor - _ (Rng.Interior.ColorIndex = WhatColorIndex) End If Next Rng End Function any help is appreciated as usual...thankyou. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count cells with diagonal borders | Excel Programming | |||
count cells with diagonal cell borders | Excel Programming | |||
Diagonal Borders | Excel Discussion (Misc queries) | |||
Creating cells with Diagonal borders | Excel Discussion (Misc queries) | |||
Test if cell has diagonal borders | Excel Programming |