Hello Faisal,I need to calculate number of cells in a row based on Color. Kindly guide me how to do. It is in a row not in a column .
Public Function CountCellsByColor(rng As Range, color As Range) As Long
Dim count As Long
Dim cell As Range
Dim colorValue As Long
Application.Volatile
colorValue = color.Interior.color
For Each cell In rng
If cell.Interior.color = colorValue Then
count = count + 1
End If
Next cell
CountCellsByColor = count
End Function
=CountCellsByColor(7:7,C7)