Goedemiddag,
Ik wil graag de somkleur hebben (zie bijlage) met onderstaande module.
Het lukt mij niet
Function SOMKLEUR(varRange As Range, varColor As Range)
Dim cell As Range
For Each cell In Application.Intersect(varRange, varRange.Parent.UsedRange)
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
SOMKLEUR = SOMKLEUR + cell.Value
End If
Next
End Function
Ik wil graag de somkleur hebben (zie bijlage) met onderstaande module.
Het lukt mij niet
Function SOMKLEUR(varRange As Range, varColor As Range)
Dim cell As Range
For Each cell In Application.Intersect(varRange, varRange.Parent.UsedRange)
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
SOMKLEUR = SOMKLEUR + cell.Value
End If
Next
End Function