V
VAILJ4
Sub ColorCount()
'Counts the number of colored
'cells in a range named Data.
Dim Blue8 As Integer
Dim Red3 As Integer
Dim Green4 As Integer
'Dim Yellow6 As Integer
Dim Cell As Range
Dim Data As Range
Set Data = Range("C3:AA75")
For Each Cell In Range("Data") '("C3:AA75")
If Cell.Interior.ColorIndex = 8 Then
Blue8 = Blue8 + 1
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + 1
ElseIf Cell.Interior.ColorIndex = 4 Then
Green4 = Green4 + 1
End If
Next
Range("M78").Value = WorksheetFunction.CountIf(Data, "N")
Range("M79").Value = WorksheetFunction.CountIf(Data, "P")
Range("M80").Value = WorksheetFunction.CountIf(Data, "S")
Range("M81").Value = WorksheetFunction.CountIf(Data, "H")
Range("M82").Value = WorksheetFunction.CountIf(Data, "B")
Range("G79").Value = Blue8
Range("G78").Value = Red3
Range("G80").Value = Green4
End Sub
Sub ColorCellBlue()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8
End Sub
Sub ColorCellRed()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 3
End Sub
Sub ColorCellGreen()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 4
End Sub
Thanks for your help
'Counts the number of colored
'cells in a range named Data.
Dim Blue8 As Integer
Dim Red3 As Integer
Dim Green4 As Integer
'Dim Yellow6 As Integer
Dim Cell As Range
Dim Data As Range
Set Data = Range("C3:AA75")
For Each Cell In Range("Data") '("C3:AA75")
If Cell.Interior.ColorIndex = 8 Then
Blue8 = Blue8 + 1
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + 1
ElseIf Cell.Interior.ColorIndex = 4 Then
Green4 = Green4 + 1
End If
Next
Range("M78").Value = WorksheetFunction.CountIf(Data, "N")
Range("M79").Value = WorksheetFunction.CountIf(Data, "P")
Range("M80").Value = WorksheetFunction.CountIf(Data, "S")
Range("M81").Value = WorksheetFunction.CountIf(Data, "H")
Range("M82").Value = WorksheetFunction.CountIf(Data, "B")
Range("G79").Value = Blue8
Range("G78").Value = Red3
Range("G80").Value = Green4
End Sub
Sub ColorCellBlue()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 8
End Sub
Sub ColorCellRed()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 3
End Sub
Sub ColorCellGreen()
ActiveCell.Offset(0, 0).Interior.ColorIndex = 4
End Sub
Thanks for your help