➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
Macros excel contar celdas de color
1. Function COLOR_COND(celda As Range) As Long
Dim ReglaActiva As Boolean
For i = 1 To celda.FormatConditions.Count
With celda.FormatConditions(i)
If .Type = xlCellValue Then
Select Case .Operator
Case xlBetween: ReglaActiva = celda.Value >=
Evaluate(.Formula1) _
And celda.Value <= Evaluate(.Formula2)
Case xlNotBetween: ReglaActiva = celda.Value <=
Evaluate(.Formula1) _
Or celda.Value >= Evaluate(.Formula2)
Case xlEqual: ReglaActiva = Evaluate(.Formula1) =
celda.Value
Case xlNotEqual: ReglaActiva = Evaluate(.Formula1) <>
celda.Value
Case xlGreater: ReglaActiva = celda.Value >
Evaluate(.Formula1)
Case xlLess: ReglaActiva = celda.Value <
Evaluate(.Formula1)
Case xlGreaterEqual: ReglaActiva = celda.Value >=
Evaluate(.Formula1)
Case xlLessEqual: ReglaActiva = celda.Value <=
Evaluate(.Formula1)
End Select
ElseIf .Type = xlExpression Then
Application.ScreenUpdating = False
celda.Select
ReglaActiva = Evaluate(.Formula1)
Range(ActiveCell.Address).Select
Application.ScreenUpdating = True
End If
If ReglaActiva Then
COLOR_COND = .Interior.color
Exit Function
End If
End With
Next i
End Function
Function CONT_COL_COND(CeldaColor As Range, Rango As Range) As Integer
Dim celda As Range
Dim resultado As Integer
Dim color As Long
color = COLOR_COND(CeldaColor)
For Each celda In Rango.Cells
If COLOR_COND(celda) = color Then
resultado = resultado + 1
End If
Next celda
CONT_COL_COND = resultado
End Function