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
| sub global()
' tableau client TC
' tableau facturation TF
' tableau totaux TT
Dim TC,TF,t as long, v as long, u as long
Dim TT() as variant
With Sheets(1)
TC=.range("a1:a" & range("a50000").end(xlup).row)
End With
With Sheets(2)
TC=.range("a1:c" & range("a50000").end(xlup).row)
End With
u=1
for t= 1 to ubound(TC,1)
for v= 1 to ubound(TF,1)
for mois= 1 to 12
redim preserve TT(1 to 3,1 to u)
if TC(t,1)=TF(t,1) and TF(t,2)=mois then
TT(1,u)= TC(t,1)
TT(2,u)= mois
TT(3,u)=TT(3,u)+TF(t,3)
u=u+1
end if
next
next
next
with sheets(2)
.range("f1:h" & u).value= worsheetfunction.transpose (TT)end with
end with
end sub |
Partager