Bonjour, merci de ton retour.
Voici le code de la feuille "Facture". Est ce suffisant ?
Encore merci
Tiri
Option Explicit
Dim EnCours As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Line1
Dim Ligne, LigneAjout As Long
Dim Reponse As Integer
Dim Question, NouvelleEntree As String
If EnCours = True Then Exit Sub
Ligne = ActiveCell.Row
If Target.Column = 2 And Target.Value2 = "Nouveau" Then
EnCours = True
AjoutReference
EnCours = False
End If
If Target.Column = 3 And Target.Value2 = "Nouveau" Then
EnCours = True
LigneAjout = Range("AB2:AB1000").Find("").Row
NouvelleEntree = InputBox("Saisir le nouveau produit :", "Ajout d'un produit")
If NouvelleEntree = "" Then
Exit Sub
Else
Reponse = MsgBox("Ok pour créer la nouvelle référence : " & NouvelleEntree & " ?", vbYesNo, "Contrôle")
If Reponse = 6 Then
Range("AB" & LigneAjout) = NouvelleEntree
EnCours = False
End If
End If
MajValidation
End If
If Target.Column = 6 Then
EnCours = True
Range("G" & Ligne) = Range("E" & Ligne) / (1 + (Range("F" & Ligne) / 100))
Range("H" & Ligne) = Range("G" & Ligne) * (Range("F" & Ligne) / 100)
Range("J" & Ligne) = Range("E" & Ligne) / Range("D" & Ligne)
EnCours = False
End If
If Target.Column = 9 And Target.Value2 = "Nouveau" Then
EnCours = True
LigneAjout = Range("Z2:Z10000").Find("").Row
NouvelleEntree = InputBox("Saisir le nouveau Type de frais :", "Ajout d'un type de frais")
If NouvelleEntree = "" Then
Exit Sub
Else
Reponse = MsgBox("Ok pour créer le nouveau type de frais : " & NouvelleEntree & " ?", vbYesNo, "Contrôle")
If Reponse = 6 Then
Range("Z" & LigneAjout) = NouvelleEntree
EnCours = False
End If
End If
MajValidation
End If
If Target.Column = 9 And Target.Value2 = "Investissement" Then
Question = InputBox("Saisir la durée de l'investissement en années", "Contrôle")
If Question = "" Then
Else
Range("K" & Ligne) = Question
Range("L" & Ligne) = Range("E" & Ligne) / Range("K" & Ligne)
End If
End If
Line1:
EnCours = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address Like ("*:*") Then Exit Sub
If Target.Column = 1 Then
Calendrier.Show
End If
End Sub