rossmcl
Programmer
- Apr 18, 2000
- 128
I have the following function whcih I want to use to check the number of cells with a font of a particular colour (ie colour index43).
I have a question: How do I make the cell I select at ***1 the active cell.
Does anyone know of an easier way to count the number of cells in a column or row with a specific text colour?
Many Thanks
Ross
Function VerticalCount(Column As String, RowStart As Integer, RowEnd As Integer)
Dim a As String
Dim i As Integer
Dim ColourTextCount As Integer
Dim Col_Red As Double
Dim Col_blue As Double
Dim Col_green As Double
'Initialise Count of Specific Coloured Cells
ColouredCellsCount = 0
CurrentRow = RowStart
Range(Column & RowStart).Select '*******************************************1*
Do While Excel.ActiveCell.Row <= RowEnd
If Excel.ActiveCell.Font.ColorIndex = 43 Then
ColourTextCount = ColourTextCount + 1
Else
End If
CurrentRow = CurrentRow + 1
Range(Column & CurrentRow).Select '***************************************1*
Loop
VerticalCount = ColourTextCount
End Function