Re copy macro

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top