Option Explicit
Sub scan_blues()
Dim ws As Worksheet
Dim rng As Range, row_ As Range, cell As Range, c As Range
Dim tot_giorni As Integer, nome As String
Const START_CELL As String = "A7"
Range("riepilogo!b7:b11").ClearContents
For Each ws In Sheets
If LCase(ws.Name) <> "riepilogo" Then
Set rng = ws.Range(START_CELL, "A" & ws.Range(START_CELL).End(xlDown).Row)
For Each row_ In rng.Offset(, 3).Resize(, 187).Rows
tot_giorni = 0
For Each cell In row_.Cells
If cell.Interior.ColorIndex = 5 Then tot_giorni = tot_giorni + 1 'blue
Next
nome = row_.Cells(0)
Set c = Sheets("riepilogo").Range("A:A").Find(nome)
c.Offset(, 1) = c.Offset(, 1) + tot_giorni
Next
End If
Next
End Sub |