[VBA][Excel] Lancer procédure
Re Bonjour,
J'explique mon programme :
1) Copier la feuille "Masque Planning" en dernier et la renommer "NomFichier"
2) Prendre les données dans Planning annuel et les mettre dans "NomFichier"
3) Mettre P,F,A dans les cellules I3 à I300
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Sheets(NomFichier).Range("I3:I300").Select
With Selection.validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="P,F,A"
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With |
Maintenant mon problème arrive :
Dès que l'on modifie la valeur I3 à I300 cela crée des actions.
Le code qui fonctionne est celui là :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Dim détailanomalie
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("G2:H500"), Target) Is Nothing Then
If Target = "A" Then
Worksheets("anomalie").Cells(6, 4) = Cells(Target.Row, 5)
Worksheets("anomalie").Cells(7, 4) = Cells(Target.Row, 4)
Cells(Target.Row, 9).Activate
ActiveCell.FormulaR1C1 = "=TODAY()"
Worksheets("anomalie").Activate
détailanomalie = Format(InputBox("Expliquer l'anomalie constatée", , ""))
Worksheets("anomalie").Cells(9, 4).Value = détailanomalie
Sheets("anomalie").Select
Worksheets("anomalie").Cells(2, 5).Activate
ActiveCell.FormulaR1C1 = "=TODAY()"
Sheets("anomalie").Activate
End If
If Target = "F" Then
Cells(Target.Row, 9).Activate
ActiveCell.FormulaR1C1 = "=TODAY()"
End If
End If
End Sub |
Le problème est sur la ligne "If Target = "A" Then"
On me dit : Incompatibilité de type
Quelqu'un a t-il une idée ??
Merci