Hello! I'm trying to track some tasks for some people that are helping me and was trying to figure out the best way to do it from an excel sheet. The task is in one cell and their name is in the cell next to it and then they highlight the cell with their name when it is complete. I was trying write some VBA to help count the highlighted cells and the non highlighted cells as they worked them but when we use it, excel acts like it is going to crash with every adjustment we make. Is there a better way to write this?
This is what I have so far:
Function CountColor(range_data As Range, criteria As Range) As Long
Dim datax As Range
Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
If datax.Interior.ColorIndex = xcolor And _
datax.Value = criteria.Value Then
CountColor = CountColor + 1
End If
Next datax
End Function
This is what I have so far:
Function CountColor(range_data As Range, criteria As Range) As Long
Dim datax As Range
Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
If datax.Interior.ColorIndex = xcolor And _
datax.Value = criteria.Value Then
CountColor = CountColor + 1
End If
Next datax
End Function