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
| Sub devellopez()
Dim cell As Range, sh As Worksheet, F1 As Worksheet, F2 As Worksheet, F3 As Worksheet
For Each sh In Sheets
If sh.CodeName = "Feuil1" Then
Set F1 = sh
ElseIf sh.CodeName = "Feuil2" Then
Set F2 = sh
ElseIf sh.CodeName = "Feuil3" Then
Set F3 = sh
End If
Next sh
F1.Cells.Copy F3.Cells(1, 1)
i = 1
For Each cell In F2.Range("a2:a" & F2.Range("a65000").End(xlUp).Row)
Nextsearchfor:
Set c = F3.Range("a" & i & ":a" & F3.Range("a65000").End(xlUp).Row).Find(cell, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then lig = c.Row
q = c.Row
p = cell.Text
m = Cells(cell.Row, 4)
o = Feuil3.Cells(lig, 4)
If F2.Cells(cell.Row, 1) = F3.Cells(lig, 1) Then
If F2.Cells(cell.Row, 4) = F3.Cells(lig, 4) Then
F3.Cells(lig, 5) = F3.Cells(lig, 5) + F2.Cells(cell.Row, 5) 'janvier
F3.Cells(lig, 6) = F3.Cells(lig, 6) + F2.Cells(cell.Row, 6) ' fevrier
F3.Cells(lig, 7) = F3.Cells(lig, 7) + F2.Cells(cell.Row, 7) ' mars
F3.Cells(lig, 8) = F3.Cells(lig, 8) + F2.Cells(cell.Row, 8) 'avril
F3.Cells(lig, 9) = F3.Cells(lig, 9) + F2.Cells(cell.Row, 9) 'mai
F3.Cells(lig, 10) = F3.Cells(lig, 10) + F2.Cells(cell.Row, 10) 'juin
F3.Cells(lig, 11) = F3.Cells(lig, 11) + F2.Cells(cell.Row, 11) 'juillet
F3.Cells(lig, 12) = F3.Cells(lig, 12) + F2.Cells(cell.Row, 12) 'aout
F3.Cells(lig, 13) = F3.Cells(lig, 13) + F2.Cells(cell.Row, 13) 'septembre
F3.Cells(lig, 14) = F3.Cells(lig, 14) + F2.Cells(cell.Row, 14) 'octobre
F3.Cells(lig, 15) = F3.Cells(lig, 15) + F2.Cells(cell.Row, 15) 'novembre
F3.Cells(lig, 16) = F3.Cells(lig, 16) + F2.Cells(cell.Row, 16) 'decembre
F3.Cells(lig, 17) = F3.Cells(lig, 17) + F2.Cells(cell.Row, 17) 'cumul
Else
i = lig
GoTo Nextsearchfor
End If
Else
F2.Cells(cell.Row, 1).EntireRow.Copy F3.Range("a" & F3.Range("a65000").End(xlUp).Row + 1)
End If
Set c = Nothing
Next cell
End Sub |
Partager