Erreur incompatibilité de type 13
Bonjour à toutes ze à tous.
Je vous dérange quelques minutes, car j'ai un soucis excel vba incompatibilité de type 13.
J'ai un fichier excel avec une liste déroulante, qui me permet de choisir en 4 types de factures fournisseurs.
une macro me rappelle qu'en fonction de ces types, une photocopie de la facture est à faire :
cela fonctionne très bien, mais qu'en j'ai plusieurs factures de même thème, je recopie la ligne en dessous (ctrl bas)
et la excel me sors une incompatibilité de type 13.
voici le code :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ligne As Integer
Dim colonne As Integer
ligne = ActiveCell.Row
colonne = ActiveCell.Column
If colonne = 1 And ligne > 1 Then
If Target.Value Like "*ACCIDENT*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*DTS*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*DTS*" Then
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
End If
If Target.Value Like "*ACCIDENT*" Then
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
End If
If Target.Value Like "*ENTRETIEN VU*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*ENTRETIEN POID LOURD*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*FRANCHISE*" Then
MsgBox ("TRANSMETTRE A LAURENT POUR VERIFICATION SOLDE")
End If
If Target.Value Like "*FRANCHISE FRAIS DE DOSSIER*" Then
MsgBox ("TRANSMETTRE A LAURENT POUR VERIFICATION SOLDE")
End If
End If
End Sub
je vous joint le petit classeur.
Si vous pouvez m'aider ça serait super, sinon tant pis vous aurez essayé.
A bientot
laurent
Bonjour,
Pour ce genre de macro, on précise en général que ça ne s'applique que pour une seule cellule à la fois.
Si tu effaces tout par exemple : pas de message.
Ou si tu remplis dix cellules en même temps (par collage par exemple) la macro ne dois pas fonctionner. (Ou alors il faut la programmer bien autrement...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ligne%, colonne%
If Target.Count = 1 Then 'Ne fonctionne que sur une cellule à la fois
ligne = ActiveCell.Row
colonne = ActiveCell.Column
If colonne = 1 And ligne > 1 Then
If Target.Value Like "*ACCIDENT*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*DTS*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*DTS*" Then
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
End If
If Target.Value Like "*ACCIDENT*" Then
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
End If
If Target.Value Like "*ENTRETIEN VU*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*ENTRETIEN POID LOURD*" Then
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
End If
If Target.Value Like "*FRANCHISE*" Then
MsgBox ("TRANSMETTRE A LAURENT POUR VERIFICATION SOLDE")
End If
If Target.Value Like "*FRANCHISE FRAIS DE DOSSIER*" Then
MsgBox ("TRANSMETTRE A LAURENT POUR VERIFICATION SOLDE")
End If
End If
End If
End SubMerci pour cette réponse.
Sais tu comment il faudrait la programmer, car j'avoue , je suis loin d'être un expert en la matière.
Bien cordialement.
Bonjour,
Une alternative à tester.
Cdlt.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 And Target.Row > 1 Then
Select Case True
Case Target.Value Like "*ACCIDENT*"
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
Case Target.Value Like "*DTS*"
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
MsgBox ("NOTER LE MONTANT DE LA FRANCHISE DANS LA CELLULE FRANCHISE")
Case Target.Value Like "*ENTRETIEN VU*"
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
Case Target.Value Like "*ENTRETIEN POID LOURD*"
MsgBox ("COPIE DE FACTURE A TRANSMETTRE AU SERVICE ACCIDENT/PANNES/DTS")
Case Target.Value Like "*FRANCHISE*" Or Target.Value Like "*FRANCHISE FRAIS DE DOSSIER*"
MsgBox ("TRANSMETTRE A LAURENT POUR VERIFICATION SOLDE")
End Select
End If
End If
End Subsuper ça fonctionne !
merci beaucoup jean eric
Cordialement