La macro ci-dessous sert pour une matrice de formation avec des dates arrivant à échéances. Le problème c'est que dès j'essaie d'incrémenter des colonnes entières pour une date de formation cela me marque error.
Je sais pas si cela peut vous aider.
Sub formation()
Application.ScreenUpdating = True
Sheets("BDD").Activate
Range("A13:CT129").Select
ActiveWorkbook.Worksheets("BDD").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BDD").Sort.SortFields.Add Key:=Range("L13: L129"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("BDD").Sort
.SetRange Range("A13:CT129")
.Header = xlGuess
.MatchCase = True
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For o = 13 To 330
For CT = 13 To 330
Cells(o, CT).Interior.ColorIndex = xlColorIndexNone
If Cells(o, CT).Value <> "" Then
Cells(o, CT).Font.ColorIndex = 3
Cells(o, CT).Font.Bold = True
End If
If (Cells(7, CT).Value <> 0) And (Cells(o, CT).Value + ((Cells(7, CT).Value) * 365)) - 30 < Cells(7, 1).Value Then
Cells(o, CT).Font.ColorIndex = 4
Cells(o, CT).Font.Bold = True
End If
If (Cells(7, CT).Value <> 0) And (Cells(o, CT).Value + (Cells(7, CT).Value) * 365) < Cells(7, 1).Value Then
Cells(o, CT).Font.ColorIndex = 3
Cells(o, CT).Font.Bold = False
End If
If Cells(o, CT).Value = "" Or Cells(o, CT).Font.ColorIndex = 3 Then
If Cells(o, 13).Value <> "" And Cells(6, CT).Value <> "" Then
If Cells(o, 4).Value = "" Then
Select Case Cells(7, CT).Value
Case "0", "CT"
Cells(o, CT).Interior.ColorIndex = xlColorIndexAutomatic
Case Else
Cells(o, CT).Interior.ColorIndex = 24
End Select
End If
End If
End If
Next
Next
Range("A7:CT7").Select
If Range("O13").Value > Range("O7").Value Then
Range("O13").Interior.ColorIndex = xlcolorAutomatic
Range("O13").Interior.ColorIndex = 26
End If
End Sub