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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Sub copie()
Dim pb As String
Dim csa As String
Dim f1 As Worksheet
Dim f2 As Worksheet
Set f2 = Workbooks("copie de cashSA.xls").Sheets("Summary")
Set f1 = Workbooks("D_presentBreaks").Sheets("D_presentBreaks")
Dim r As Range
Dim r1 As String
Set r = f2.Range("D14:D19")
Dim i As Integer
Dim j As Integer
Dim nbligne As Long
nbligne = f1.Range("A1").CurrentRegion.Rows.Count
i = 2
j = 14
Do Until i = nbligne
'For i = 2 To nbligne Step 1
pb = f1.Cells(i, 1).Value
'For j = 14 To 19 Step 1
'With r1
'for jFor Each r1 In r
Do Until j = 19
csa = f2.Cells(j, 4).Value
If csa = pb Then
f2.Cells(j, 5).Value = f1.Cells(i, 2).Value
f2.Cells(j, 7).Value = f1.Cells(i, 8).Value
f2.Cells(j, 8).Value = f1.Cells(i, 6).Value
f2.Cells(j, 10).Value = f1.Cells(i, 10).Value
f2.Cells(j, 11).Value = f1.Cells(i, 4).Value
f2.Cells(j, 13).Value = f1.Cells(i, 9).Value
Else
f2.Cells(j, 5).Value = 0
f2.Cells(j, 7).Value = 0
f2.Cells(j, 8).Value = 0
f2.Cells(j, 10).Value = 0
f2.Cells(j, 11).Value = 0
f2.Cells(j, 13).Value = 0
End If
j = j + 1
Loop
i = i + 1
Loop
End Sub |
Partager