Sub TCD_Good_Macro()
Dim C As Range, Plage As Range, Ligne As Variant, Col As Long
Dim Wbk As Workbook, Sh As Worksheet
Set Wbk = Workbooks.Open("H:\Central Sourcing & production\Divisional Check\Div. Checks\" & _
"Divisional Checks - Refresh Data.xlsx")
Set Sh = Sheets("MISSING PRIO")
With Sh
Set Plage = .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
End With
With Sheets("Expected (2)")
Set C = .Cells(1, .Columns.Count).End(xlToLeft).Offset(, 1)
If C.Column = 2 Then
C.Value = Date
Else
C.Value = DateAdd("ww", 1, Date)
End If
C.NumberFormat = "d/mm/yy"
Col = C.Column
For Each C In Plage
Ligne = Application.Match(C.Value, .[A:A], 0)
If IsNumeric(Ligne) Then
.Cells(Ligne, Col) = .Cells(Ligne, Col) + 1
End If
Next C
Ligne = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
.Cells(Ligne, Col) = Application.Sum(.Range(.Cells(2, Col), .Cells(Ligne - 1, Col)))
End With
Wbk.Close False
End Sub