Private Sub Worksheet_Change(ByVal Target As Range)
'Stop
'pour éviter que la macro tourne en rond..
Application.EnableEvents = False
a = Target.Row
'lancement de la macro dès qu'on change une cellule dans les 4 premières colonnes
If Not (Intersect(Target, Range("A:D")) Is Nothing) Then
Cells(a, 6) = Date
Cells(a, 7) = Time
If Cells(a, 1) = "Non" Then
Cells(a, 2) = "Non Pertinent"
Cells(a, 3) = "Non Pertinent"
Cells(a, 4) = "Non Pertinent"
Range("A1").End(xlDown).Offset(1, 0).Select
End If
If Cells(a, 1) = "Oui" And Cells(a, 2) = "Oui" Then
Cells(a, 3) = "Non Pertinent"
Cells(a, 4) = "Non Pertinent"
Range("A1").End(xlDown).Offset(1, 0).Select
'ficher à ouvrir et/ou activer
'on vérifie si le classeur fait partie des classeurs ouverts
ClasseurOuvert = False
For Each Classeur In Workbooks
If Classeur.Name = "Classeur 2.xlsm" Then ClasseurOuvert = True
Next Classeur
If ClasseurOuvert Then
Classeur.Activate
Else
ChDir "Chemin du dossier"
Workbooks.Open Filename:="Chemin du dossier \classeur2.xlxm"
End If
End If
If Cells(a, 1) = "Oui" And Cells(a, 2) = "Non" And Cells(a, 3) = "Oui" Then
Cells(a, 4) = "Non Pertinent"
Range("A1").End(xlDown).Offset(1, 0).Select
End If
If Cells(a, 1) = "Oui" And Cells(a, 2) = "Non" And Cells(a, 3) = "Non Pertinent" Then
Cells(a, 4) = "Oui"
Range("A1").End(xlDown).Offset(1, 0).Select
End If
If Cells(a, 1) = "Oui" And Cells(a, 2) = "Non" And Cells(a, 4) = "Oui" Then
Cells(a, 3) = "Non Pertinent"
Range("A1").End(xlDown).Offset(1, 0).Select
End If
End If
Application.EnableEvents = True
End Sub