1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Sub DataExportEn()
Dim Colonne As Byte
Dim Trouve
With Sheets("Sheet1")
If UCase(Left(.Range("I2"), 2)) = "AV" Then
Colonne = Sheet2.Range("IV14").End(xlToLeft).Column + 1
If Colonne < 4 Then Colonne = 4
.Range("J2:J4").Copy Sheet2.Cells(14, Colonne)
.Range("E2").Copy Sheet2.Cells(8, Colonne)
ElseIf UCase(Left(.Range("I2"), 2)) = "AP" Then
Set Trouve = Sheet2.Range("D8:IV8").Find(.Range("E2"), LookIn:=xlValues)
If Trouve Is Nothing Then
MsgBox ("Erreur, impossible de trouver cette valeur")
Exit Sub
End If
.Range("J2:J4").Copy Sheet2.Cells(21, Trouve.Column)
End If
Application.DisplayAlerts = False
Cells.ClearContents
'.Delete
Application.DisplayAlerts = True
End With
End Sub |
Partager