Sub Worksheet_Activate()
Range("B9:G100").ClearContents
LenCours = 9
For L = 9 To 158
If IsDate(Sheets("STOCK").Cells(L, "G")) And Sheets("STOCK").Cells(L, "G") <= Date - 7 Then
Sheets("Urgent").Cells(LenCours, "B") = Sheets("STOCK").Cells(L, "B")
Sheets("Urgent").Cells(LenCours, "C") = Sheets("STOCK").Cells(L, "C")
Sheets("Urgent").Cells(LenCours, "E") = Sheets("STOCK").Cells(L, "E")
Sheets("Urgent").Cells(LenCours, "F") = Sheets("STOCK").Cells(L, "G")
Sheets("Urgent").Cells(LenCours, "G") = Sheets("STOCK").Cells(L, "H")
LenCours = LenCours + 1
End If
Next L
Range("B9:G100").Select
ActiveWorkbook.Worksheets("URGENT").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("URGENT").Sort.SortFields.Add Key:=Range("F9:F100") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("URGENT").Sort
.SetRange Range("B9:G100")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
[B6].Select
End Sub