Necesito un funcion para contar celdas segun el color del contenido de una celda en Call.
La siguiente funcion es la que utlizo en Excel, pero mi empresa a decidido (con buen criterio) usar OpenOffice pero las funciones en VBA no son compatibles.
Gracias de antemano
la funcion es la siguiente:
Function FestivosByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
'
' Esta funcion devuelve el numero de festivos (color rojo) siempre que sean mañanas "M" o tardes "T" o noches "N"
Dim Rng As Range
Application.Volatile True
For Each Rng In InRange.Cells
If Rng.Value = "M" Or Rng.Value = "T" Or Rng.Value = "N" Then
If OfText = True Then
FestivosByColor = FestivosByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
FestivosByColor = FestivosByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
End If
Next Rng
End Function
La llamada queda asi
=FestivosByColor(C6:BF6;3;VERDADERO) donde el 3 se refiere al color ROJO.