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 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| Sub CreationFichierOutput()
'Procédure qui alimente une nouvelle feuille avec les données CREST et des données fixes"
Dim i As Integer
Dim strDateChanger As String
i = 1
NouvelleFeuille ("OUTPUT")
Dim wsIn As Worksheet
Set wsIn = Workbooks(Mid(strNomFichierInput, InStr(1, strNomFichierInput, "\") + 1)).Worksheets("INPUT")
Dim r As Range
For Each r In wsIn.Range("A2:A" & wsIn.Range("A" & wsIn.Rows.Count).End(xlUp).Row)
With Sheets("OUTPUT")
strDateChanger = r.Offset(0, 4).Value
.Cells(i, 1) = "PARBGB"
.Cells(i, 2) = r.Offset(0, 6).Value
.Cells(i, 3) = "Y"
.Cells(i, 4) = "R/D"
.Cells(i, 5) = r.Offset(0, 2).Value
.Cells(i, 6) = "NEWM"
.Cells(i, 8) = Right(strDateChanger, 4) & Decode(Mid(strDateChanger, 4, 3), "Jan", "01", _
"Feb", "02", "Mar", "03", "Apr", "04", "May", "05", "Jun", "06", "Jul", "07", "Aug", "08", "Sep", "09", _
"Oct", "10", "Nov", "11", "Dec", "12") & Left(strDateChanger, 2)
.Cells(i, 9) = Format(Date, "yyyymmdd")
.Cells(i, 15) = r.Offset(0, 8).Value
.Cells(i, 17) = "FAMT"
.Cells(i, 18) = r.Offset(0, 11).Value
.Cells(i, 19) = "100002170100"
.Cells(i, 35) = "CRSTGB22XXX"
.Cells(i, 37) = "CRST"
.Cells(i, 39) = "CRST"
.Cells(i, 40) = r.Offset(0, 13).Value
.Cells(i, 41) = r.Offset(0, 14).Value
.Cells(i, 44) = "CRST"
.Cells(i, 45) = r.Offset(0, 13).Value
.Cells(i, 46) = r.Offset(0, 14).Value
End With
i = i + 1
Next r
End Sub |