Salut a toutes et tous,
Voila lors de la création d'une nouvelle ligne, j'aimerai faire une Mise en forme conditionnelle, alors voila ce que j'ai fait et biensur cela ne fonctionne pas.
Voici le code du bouton de validation :
Private Sub cmdValider_Click()
Dim informer, nbligne, nbligne2
If QtBox.Value = "" Then
informer = MsgBox("Qté obligatoire !", vbOKOnly, "Ajout impossible...")
Exit Sub
End If
With ActiveSheet
.Unprotect
nbligne = ActiveSheet.Range("G4")
nbligne = nbligne + 1
.Range("G4") = nbligne
nbligne2 = nbligne + 12
If OptionButton1 = True Then .Range("B" & nbligne2) = "Entrée"
If OptionButton2 = True Then .Range("B" & nbligne2) = "Sortie"
.Range("C" & nbligne2) = CDate(DateBox.Value)
.Range("D" & nbligne2) = FournisseurBox.Value
.Range("E" & nbligne2) = RefBox.Value
.Range("F" & nbligne2) = QtBox.Value
.Range("G" & nbligne2) = txtCommande.Value
.Range("I" & nbligne2) = txtReferenceProduit.Value
.Range("K" & nbligne2) = cbxOpérateur.Value
.Range("B" & nbligne2).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="Entrée"""
Selection.FormatConditions(1).Interior.ColorIndex = 36
.Protect
End With
Unload AjoutLigne
End Sub
Merci pour votre aide, G'Claire