Function ColMois(Mois As String) As Byte
Dim i As Integer
LesMois = Array("JANVIER", "FEVRIER", "MARS", "AVRIL", "MAI", "JUIN", "JUILLET", "AOÛT", "SEPTEMBRE", "OCTOBRE", "NOVEMBRE", "DÉCEMBRE")
For i = 0 To 11
If Mois = LesMois(i) Then
ColMois = i + 3
Exit Function
End If
Next i
End Function
Sub Planning()
Dim i As Long
Dim ShBas As Worksheet
Dim ShPl As Worksheet
Dim Col As Byte
Dim Lig As Integer
Set ShBas = Sheets("Base contrat")
Set ShPl = Sheets("Planning de passage")
For i = 3 To 64 'ShBas.Cells(Rows.Count, 10).End(xlUp).Row formule si rien dans cellules à partir de 139
If ShBas.Cells(i, 10) <> 0 And ShBas.Cells(i, 13) <> "" Then
Col = ColMois(CStr(ShBas.Cells(i, 13)))
Lig = CInt(ShBas.Cells(i, 26)) + 5
ShPl.Cells(Lig, Col) = ShBas.Cells(i, 2)
End If
Next i
End Sub