Copier / Coller
Bonjour,
J'ai un problème avec Ma codification.
je souhaite faire un copier /coller de certaines informations d'un point A à un point B (voir image ci-dessous)
la codification fonctionne par moment. lorsque je reclasse mes affaires suivant le numéro d'affaire ou par date de création par exemple, rien ne fonctionne. le système copie bien ce que je lui demande mais ne le colle pas au bon endroit.
Pouvez vous m'aider s'il vous plait ?
Pour activer la vba, il faut cliquer sur le bouton marche / arrêt.
Merci,
Bonjour,
quel est ton code de copie ? (poste le directement sur le forum que tous le monde en profite avec ou sans excel ..)
Bonjour,
Il faut aller dans la feuille 1 et c'est les dernières formules:
Dim ligne As Integer
Dim colonne As Integer
If Not Application.Intersect(Target, Columns("a:f")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
End If
If Not Application.Intersect(Target, Columns("a")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("a" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 52) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("c")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("c" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 53) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("d")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("d" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 54) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("e")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("e" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 55) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("g")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("g" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 56) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("j")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("j" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 57) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("m")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("m" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 58) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("q")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("q" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 59) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("v")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("v" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 60) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("x")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("x" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 61) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("y")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("y" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 62) = Target
End If
Next i
End If
If Not Application.Intersect(Target, Columns("aa")) Is Nothing Then
ligne = Target.Row
colonne = Target.Column
For i = 2 To Sheets("En cours").Range("aa" & Rows.Count).End(xlUp).Row
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
Sheets("En cours").Cells(i, 63) = Target
End If
Next i
End If
Merci par avance,
End Sub
Bonjour,
Quelqu'un peut m'aider s'il vous plait ?
Merci par avance,
bonjour,
inutile de multiplier les discussions .. si tu n'as pas eu de réponse c'est peu-être à cause d'un manque de clarté...
as quoi sert ce test que tu répète as de nombreuse reprise :
If Sheets("En cours").Cells(i, 3) = Cells(ligne, 3) Then
...
combien de feuilles sont concernées par tes tests ..? tu as la feuille "En cours" et la feuille courante vu que tu utilise Cells(ligne... sans préciser la feuille ...) .?
s'il s'agit de la même feuille tu peu aussi écrire ton code ainsi :
If Sheets("En cours").Cells(i, 3) = Sheets("En cours").Cells(ligne, 3) Then
ou bien :
If i =ligne Then
est-ce bien le code désiré ?
Merci Pierre.
la dernière ligne semble resolver mon problème.. je ferai d'autres testes pour le confirmer
Franchement merci de votre aide.
Starr a écrit :Merci Pierre.
la dernière ligne semble resolver mon problème.. je ferai d'autres testes pour le confirmer
Franchement merci de votre aide.
eu j'ai pas voulu donner directement le résultat as ton problème j'ai juste voulu te montrer que ton code ne semblait pas faire ce que tu voulais....
revoit de nouveau le code et imagine le test que tu dois faire ...puis corrige ta ligne if..