-
Notifications
You must be signed in to change notification settings - Fork 0
/
encours.bas
1230 lines (1059 loc) · 45.9 KB
/
encours.bas
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Attribute VB_Name = "Module1"
'Encours
'Encours moyens - Calcul des encours moyens des portefeuilles de la CDG
'Copyright (C) 2012 Yassine Maaroufi - <[email protected]>
'Distribué sous GPLv3 - http://www.gnu.org/copyleft/gpl.html
'D�claration des variables publiques
Public RSH As Worksheet 'Feuille r�cap
Public TASH As Worksheet 'Feuille tableaux analytiques
Public TPSH As Worksheet 'Feuille tableau analytique pr�ts
Public ASH As Worksheet 'Feuille encours moyen actions
Public TSH As Worksheet 'Feuille encours moyen taux
Public YSH As Worksheet 'Feuille encours moyen transactions
Public PSH As Worksheet 'Feuille encours moyen pr�ts
Public SSH As Worksheet 'Feuille soldes
Public BSH As Worksheet 'Feuille base de donn�es
Public BPSH As Worksheet 'Feuille base de donn�es pr�ts
Public ESH As Worksheet 'Feuille �ch�ancier
'Public XSH As Worksheet 'Feuille de tests
'Autre
Public di As Integer 'Date de premi�re op�ration
Public dd As String 'Date de la derni�re op�ration
Public s As New Collection '
Public c As New Collection 'Collection de titres pour les tableaux analytiques
Public arr() As Variant
'Portefeuilles titre -> Num�ros de comptes correspondants
Public Const P_OBLIG_INVEST As String = "411100 411600 412100 412200 412300 412400"
Public Const P_OBLIG_PLACT As String = "311100 313100 313200 313300 313400"
Public Const P_ACTION_PART As String = "422100 422200 422300 422500 423100 423200 423500"
Public Const P_ACTION_PLACT As String = "315100 315200"
Public Const P_ACTION_TRANS As String = "305200"
'Public Const P_ACTION_TRANS As Variant = Array("305200")
'Index
'Feuille 'Donn�es Titres' (BSH)
Public Const BSHC As String = "AK" 'Derni�re colone
Public Const IBC As Integer = 5 'Num�ro de compte
Public Const IBD As Integer = 11 'Date comptable
Public Const IBV As Integer = 37 'Valeur comptable
Public Const IBCC As Integer = 22 'Code du titre
Public Const IBP As Integer = 20 'Poste (achat, vente, reclassement, augmentation/r�duction capital)
Public Const IBO As Integer = 4 'op_evenement (pour le cas du portefeuille TRANS. Les op�rations ne doivent pas �tre prises en comptes si champ non vide)
'Feuille 'Donn�es pr�ts' (BPSH)
Public Const IPBO As Integer = 1 'Num�ro d'op�ration
Public Const IPBP As Integer = 2 'Poste
Public Const IPBC As Integer = 3 'Contrepartie
Public Const IPBD As Integer = 4 'Date de valeur
Public Const IPBR As Integer = 5 'Date de remboursement
Public Const IPBN As Integer = 6 'Nominal
Public Const IPBV As Integer = 12 'Montant remboursement
'public ipbl as Integer 'PNL
'Public ipbc As Integer 'Num�ro de compte
'Public ipbd As Integer 'Date comptable
'Public ipbv As Integer 'Valeur comptable
'Feuille 'Ech�ancier' (ESH)
Public Const IEN As Integer = 1 'Colonne num�ro d'op�ration
Public Const IED As Integer = 2 'Colone date
Public Const IET As Integer = 3 'Colone tomb�e
'Feuille 'soldes' (SSH)
Public Const ISL As Integer = 6 'Ligne de d�part du tableau des soldes
Public Const ISLAT As Integer = ISL + 1 'Ligne du solde actions transactions
Public Const ISLAP As Integer = ISL + 2 'Ligne du solde actions placement
Public Const ISLAI As Integer = ISL + 3 'Ligne du solde actions participation
Public Const ISLOP As Integer = ISL + 4 'Ligne du solde obligations placement
Public Const ISLOI As Integer = ISL + 5 'Ligne du solde obligations investissement
Public Const ISLP As Integer = ISL + 6 'Ligne du solde pr�ts
Public Const ISC As Integer = 5 'Colonne de d�part du tableau des soldes
Public Const ISAL As Integer = 16 'Ligne de d�part du tableau des soldes actions
'Public Const isac As Integer = 5 'Colonne de d�part du tableau des soldes actions
Public isac As Integer 'Colonne de d�part du tableau des soldes actions
Public Const ISACN As Integer = 2 'Colonne nom
Public Const ISACC As Integer = 3 'Colonne code
Public Const ISACP As Integer = 4 'Colonne portefeuille
'Feuille 'encours'
Public Const IEL As Integer = 5 'Ligne de d�but du premier tableau
Public Const IEC As Integer = 2 'Colonne de d�but du premier tableau
Public Const IECE As Integer = 8 'Espace entre les deux tableaux
Public Const IECM As Integer = IEC + 1 'Colonne mouvement du premier tableau
Public Const IECA As Integer = IEC + 2 'Colonne acquisition du premier tableau
Public Const IECC As Integer = IEC + 3 'Colonne cession du premier tableau
Public Const IECS As Integer = IEC + 4 'Colonne solde du premier tableau
Public Const IECD As Integer = IEC + 5 'Colonne dur�e du premier tableau
Public Const IECP As Integer = IEC + 6 'Colonne des pond�rations (solde * dur�e) du premier tableau
Public Const IEC2 As Integer = IEC + IECE 'Colonne de d�but de la 2�me s�rie de tableaux
Public Const IEC2M As Integer = IEC2 + 1 'Colonne mouvement du 2�me tableau
Public Const IEC2A As Integer = IEC2 + 2 'Colonne acquisition du 2�me tableau
Public Const IEC2C As Integer = IEC2 + 3 'Colonne cession du 2�me tableau
Public Const IEC2S As Integer = IEC2 + 4 'Colonne solde du 2�me tableau
Public Const IEC2D As Integer = IEC2 + 5 'Colonne dur�e du 2�me tableau
Public Const IEC2P As Integer = IEC2 + 6 'Colonne des pond�rations (solde * dur�e) du 2�me tableau
'Feuille 'R�cap' (RSH)
Public Const IRC As Integer = 3 'Colonne de d�but des soldes comptables
Public Const IRPDD As String = "H3" 'Case date de d�but (pr�ts)
Public Const IRPDF As String = "H4" 'Case date de fin (pr�ts)
Public Const IRATE As Integer = 9 'Ligne des encours actions transactions
Public Const IRAPE As Integer = 10 'Ligne des encours actions placement
Public Const IRAIE As Integer = 11 'Ligne des encours actions participation
Public Const IROPE As Integer = 12 'Ligne des encours taux placement
Public Const IROIE As Integer = 13 'Ligne des encours taux investissement
Public Const IRPE As Integer = 14 'Ligne des encours pr�ts
Public Const IRAT As Integer = 18 'Ligne du solde actions transactions
Public Const IRAP As Integer = 19 'Ligne du solde actions placement
Public Const IRAI As Integer = 20 'Ligne du solde actions participation
Public Const IROP As Integer = 21 'Ligne du solde taux placement
Public Const IROI As Integer = 22 'Ligne du solde taux investissement
Public Const IRP As Integer = 23 'Ligne du solde pr�ts
Public Const IRRE As String = "D9:O13" 'Espace � r�initialiser (encours moyens)
Public Const IRRS As String = "D18:O22" 'Espace � r�initialiser (soldes comptables)
Public Const IRREP As String = "D14:O14" 'Espace � r�initialiser (encours moyens pr�ts)
Public Const IRRSP As String = "D23:O23" 'Espace � r�initialiser (soldes comptables pr�ts)
Sub variables()
Set RSH = ThisWorkbook.Worksheets("R�cap")
Set TASH = ThisWorkbook.Worksheets("Tableaux Analytiques Titres")
Set TPSH = ThisWorkbook.Worksheets("Tableau Analytique Pr�ts")
Set ASH = ThisWorkbook.Worksheets("EM Actions")
Set TSH = ThisWorkbook.Worksheets("EM Oblig")
Set YSH = ThisWorkbook.Worksheets("EM Trans")
Set PSH = ThisWorkbook.Worksheets("EM Pr�ts")
Set SSH = ThisWorkbook.Worksheets("Soldes D�but")
Set BSH = ThisWorkbook.Worksheets("Donn�es Titres")
Set BPSH = ThisWorkbook.Worksheets("Donn�es Pr�ts")
Set ESH = ThisWorkbook.Worksheets("Ech�ancier Pr�ts")
'Set xsh = ThisWorkbook.Worksheets("test")
'Emplacements dans la feuille 'Soldes' partie soldes par titre
'Utiliser avec ssh.Cells(isal, isac)
isac = 5 'Colonne de d�part
End Sub
Sub commencer()
'TESTDateDebut = Now
optimisationD�but
variables
r�initialiser
'Encours titres
encours_titres 'Encours par op�ration/mois
'encours_titres_2 'Encours par op�ration/mois (array) (plus rapide)
init_tableaux_analytiques
optimisationFin
'MsgBox DateDiff("s", TESTDateDebut, Now)
End Sub
Sub commencer_prets()
'TESTDateDebut = Now
optimisationD�but
variables
r�initialiser_prets
'Encours pr�ts
encours_prets_2
init_tableau_analytique_prets
optimisationFin
'MsgBox DateDiff("s", TESTDateDebut, Now)
End Sub
Sub encours_titres()
'Filtre et ordonne la base de donn�es par date comptable du plus ancien au plus r�cent
trier_par_dates BSH, "K"
'D�termine l'ann�e de base
Dim y As Integer
y = Year(BSH.Cells(2, IBD))
di = Year(BSH.Cells(2, IBD))
'Cr�e le contenant des calculs
Set s = New Collection
s.Add New Collection, "Action"
s.Add New Collection, "Tx"
s.Item("Action").Add New Collection, "TRANS"
s.Item("Action").Add New Collection, "PLACT"
s.Item("Action").Add New Collection, "PART"
s.Item("Tx").Add New Collection, "PLACT"
s.Item("Tx").Add New Collection, "INVEST"
For Each i In s
For Each j In i
j.Add CDate("01/01/" & y), "date" 'Date
j.Add 0, "Mvt" 'Mouvement
j.Add 0, "Pond." 'Solde * Dur�e
Next j
Next i
'Collection tableaux analytiques
Set c = New Collection
c.Add New Collection, "TRANS"
c.Add New Collection, "PART"
c.Add New Collection, "PLACT"
'Cherche le solde de d�part correspondant � l'ann�e de base dans le tableau des soldes
With SSH
i = ISC
Do Until IsEmpty(.Cells(ISL, i))
If y - 1 = .Cells(ISL, i) Then
s.Item("Action").Item("TRANS").Add .Cells(ISLAT, i), "solde"
s.Item("Action").Item("PLACT").Add .Cells(ISLAP, i), "solde"
s.Item("Action").Item("PART").Add .Cells(ISLAI, i), "solde"
s.Item("Tx").Item("PLACT").Add .Cells(ISLOP, i), "solde"
s.Item("Tx").Item("INVEST").Add .Cells(ISLOI, i), "solde"
End If
i = i + 1
Loop
End With
'Cherche les soldes de d�part des tableaux analytiques
With SSH
'Cherche la colonne correspondante � l'ann�e de base dans le tableau des soldes actions
i = isac
Do Until IsEmpty(.Cells(ISAL, i))
If y - 1 = .Cells(ISAL, i) Then isac = i
i = i + 1
Loop
'Compile la liste des actions par portefeuilles
i = ISAL + 1
Do Until IsEmpty(.Cells(i, ISACN))
For Each j In Array("TRANS", "PLACT", "PART")
If j = .Cells(i, ISACP) Then
c.Item(.Cells(i, ISACP)).Add New Collection, .Cells(i, ISACC)
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add .Cells(i, ISACC), "code"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add .Cells(i, ISACN), "nom"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add .Cells(i, isac), "solde"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add .Cells(i, isac), "solde fin"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add 0, "acquisition"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add 0, "augmentation capital"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add 0, "reclassement"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add 0, "r�duction capital"
c.Item(.Cells(i, ISACP)).Item(.Cells(i, ISACC)).Add 0, "cession"
End If
Next j
i = i + 1
Loop
End With
'Calcule le solde comptable
With BSH
i = 2
jat = 0 'Compteur de lignes pour encours actions transactions
jap = 0 'Compteur de lignes pour encours actions placement
jai = 0 'Compteur de lignes pour encours actions participation
jtp = 0 'Compteur de lignes pour encours taux placement
jti = 0 'Compteur de lignes pour encours taux investissement
dd = .Cells(i, IBD) 'Date de la derni�re op�ration
affiche_titres_encours_op YSH, IEC, "TRANS"
affiche_titres_encours_op ASH, IEC2, "PLACT"
affiche_titres_encours_op ASH, IEC, "PART"
affiche_titres_encours_op TSH, IEC2, "PLACT"
affiche_titres_encours_op TSH, IEC, "INVEST"
Do Until IsEmpty(.Cells(i, IBD))
If Month(dd) = Month(.Cells(i, IBD)) - 1 Then 'Solde mensuel
calcul_mensuel "Action", "TRANS", IRAT, IRATE, i
calcul_mensuel "Action", "PLACT", IRAP, IRAPE, i
calcul_mensuel "Action", "PART", IRAI, IRAIE, i
calcul_mensuel "Tx", "PLACT", IROP, IROPE, i
calcul_mensuel "Tx", "INVEST", IROI, IROIE, i
End If
'D�termine la date de la derni�re op�ration
If CDate(.Cells(i, IBD)) > CDate(dd) Then
dd = .Cells(i, IBD)
End If
'Action TRANS
'If .Cells(i, IBC) = P_ACTION_TRANS Then
For Each j In Split(P_ACTION_TRANS)
If .Cells(i, IBC) = j Then
d = s.Item("Action").Item("TRANS").Item("date")
If d <> .Cells(i, IBD) Then
jat = jat + 1
End If
calculs "Action", "TRANS", YSH, i, jat - 1, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IRAT, IRATE
If IsEmpty(.Cells(i, IBO)) Then calculs_tableaux_analytiques "TRANS", i 'Pour �viter de prendre en compte les �critures (ext ATPD et �quivalent)
End If
'End If
Next j
'Action PLACT
For Each j In Split(P_ACTION_PLACT)
If .Cells(i, IBC) = j Then
d = s.Item("Action").Item("PLACT").Item("date")
If d <> .Cells(i, IBD) Then
jap = jap + 1
End If
calculs "Action", "PLACT", ASH, i, jap - 1, IEC2, IEC2S, IEC2D, IEC2P, IEC2M, IEC2A, IEC2C, IRAP, IRAPE
calculs_tableaux_analytiques "PLACT", i
End If
Next j
'Action PART
For Each j In Split(P_ACTION_PART)
If .Cells(i, IBC) = j Then
d = s.Item("Action").Item("PART").Item("date")
If d <> .Cells(i, IBD) Then
jai = jai + 1
End If
calculs "Action", "PART", ASH, i, jai - 1, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IRAI, IRAIE
calculs_tableaux_analytiques "PART", i
End If
Next j
'OBL PLACT
For Each j In Split(P_OBLIG_PLACT)
If .Cells(i, IBC) = j Then
d = s.Item("Tx").Item("PLACT").Item("date")
If d <> .Cells(i, IBD) Then
jtp = jtp + 1
End If
calculs "Tx", "PLACT", TSH, i, jtp - 1, IEC2, IEC2S, IEC2D, IEC2P, IEC2M, IEC2A, IEC2C, IROP, IROPE
End If
Next j
'OBL INVEST
For Each j In Split(P_OBLIG_INVEST)
If .Cells(i, IBC) = j Then
d = s.Item("Tx").Item("INVEST").Item("date")
If d <> .Cells(i, IBD) Then
jti = jti + 1
End If
calculs "Tx", "INVEST", TSH, i, jti - 1, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IROI, IROIE
End If
Next j
i = i + 1
Loop
End With
''
correction_fin "Action", "TRANS", YSH, jat, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IRAT, IRATE
correction_fin "Action", "PLACT", ASH, jap, IEC2, IEC2S, IEC2D, IEC2P, IEC2M, IEC2A, IEC2C, IRAP, IRAPE
correction_fin "Action", "PART", ASH, jai, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IRAI, IRAIE
correction_fin "Tx", "PLACT", TSH, jtp, IEC2, IEC2S, IEC2D, IEC2P, IEC2M, IEC2A, IEC2C, IROP, IROPE
correction_fin "Tx", "INVEST", TSH, jti, IEC, IECS, IECD, IECP, IECM, IECA, IECC, IROI, IROIE
colorer_tableau YSH, IEL, IEC, IECP
colorer_tableau ASH, IEL, IEC2, IEC2P
colorer_tableau ASH, IEL, IEC, IECP
colorer_tableau TSH, IEL, IEC2, IEC2P
colorer_tableau TSH, IEL, IEC, IECP
End Sub
Sub affiche_titres_encours_op(sh As Worksheet, col As Integer, portefeuille As String)
With sh
'titres = "Date,Mvt,Acquisition,Cession,Solde,Dur�e,Solde * dur�e"
'If portefeuille = "PRETS" Then titres = "Date,Mvt,Octroi,Remboursement,Solde,Dur�e,Solde * dur�e"
titres = Array("Date", "Mvt", "Acquisition", "Cession", "Solde", "Dur�e", "Solde * dur�e")
If portefeuille = "PRETS" Then titres = Array("Date", "Mvt", "Octroi", "Remboursement", "Solde", "Dur�e", "Solde * dur�e")
'Grand titre
lignetitre = IEL - 2
.Cells(lignetitre, col) = portefeuille
'Sous-titres (array)
lignetitre = IEL - 1
.Range(.Cells(lignetitre, col), .Cells(lignetitre, UBound(titres) + col)) = titres
End With
End Sub
Function calcul_mensuel(item1, item2, rl, rle, i)
RSH.Cells(rl, IRC + Month(dd)) = s.Item(item1).Item(item2).Item("solde")
'Encours mensuel
d = s.Item(item1).Item(item2).Item("date")
dn = DateSerial(Year(dd), Month(dd) + 1, 0) - CDate(d) + 1 'derni�re op�ration du mois -> fin de mois + 1
j = s.Item(item1).Item(item2).Item("Pond.") + s.Item(item1).Item(item2).Item("solde") * dn
RSH.Cells(rle, IRC + Month(dd)) = j / _
(DateSerial(Year(dd), Month(dd) + 1, 0) - _
(CDate("01/01/" & Year(BSH.Cells(2, IBD))) - 1))
End Function
Function calculs(item1, item2, sh, i, ligne, c, cs, cd, cp, cm, ca, cc, rl, rle)
With sh
ligne2 = IEL + ligne
d = s.Item(item1).Item(item2).Item("date")
If d <> BSH.Cells(i, IBD) Then
.Cells(ligne2, c) = s.Item(item1).Item(item2).Item("date")
.Cells(ligne2, cs) = s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cs).NumberFormat = "#,##0.00"
du = CDate(BSH.Cells(i, IBD)) - CDate(d)
.Cells(ligne2, cd) = du
.Cells(ligne2, cp) = du * s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cp).NumberFormat = "#,##0.00"
'Mvt
.Cells(ligne2, cm) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cm).NumberFormat = "#,##0.00"
If s.Item(item1).Item(item2).Item("Mvt") > 0 Then
.Cells(ligne2, cc) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cc).NumberFormat = "#,##0.00"
Else
.Cells(ligne2, ca) = -s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, ca).NumberFormat = "#,##0.00"
End If
s.Item(item1).Item(item2).Remove "Mvt"
s.Item(item1).Item(item2).Add BSH.Cells(i, IBV), "Mvt"
'Somme: Solde * Dur�e
j = s.Item(item1).Item(item2).Item("Pond.") + du * s.Item(item1).Item(item2).Item("solde")
s.Item(item1).Item(item2).Remove "Pond."
s.Item(item1).Item(item2).Add j, "Pond."
Else
j = s.Item(item1).Item(item2).Item("Mvt") + BSH.Cells(i, IBV)
s.Item(item1).Item(item2).Remove "Mvt"
s.Item(item1).Item(item2).Add j, "Mvt"
End If
j = s.Item(item1).Item(item2).Item("solde") - BSH.Cells(i, IBV)
s.Item(item1).Item(item2).Remove "solde"
s.Item(item1).Item(item2).Add j, "solde"
s.Item(item1).Item(item2).Remove "date"
s.Item(item1).Item(item2).Add BSH.Cells(i, IBD), "date"
End With
End Function
Function calculs_2(item1, item2, sh, i, ligne, c, cs, cd, cp, cm, ca, cc, rl, rle)
With sh
ligne2 = IEL + ligne
d = s.Item(item1).Item(item2).Item("date")
If d <> arr(i, IBD) Then
'.Cells(ligne2, c) = s.Item(item1).Item(item2).Item("date")
.Cells(ligne2, c) = Format(s.Item(item1).Item(item2).Item("date"), "mm/dd/yyyy")
.Cells(ligne2, cs) = s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cs).NumberFormat = "#,##0.00"
du = CDate(arr(i, IBD)) - CDate(d)
.Cells(ligne2, cd) = du
.Cells(ligne2, cp) = du * s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cp).NumberFormat = "#,##0.00"
.Cells(ligne2, cm) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cm).NumberFormat = "#,##0.00"
If s.Item(item1).Item(item2).Item("Mvt") > 0 Then
.Cells(ligne2, cc) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cc).NumberFormat = "#,##0.00"
Else
.Cells(ligne2, ca) = -s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, ca).NumberFormat = "#,##0.00"
End If
s.Item(item1).Item(item2).Remove "Mvt"
s.Item(item1).Item(item2).Add arr(i, IBV), "Mvt"
'Somme: Solde * Dur�e
j = s.Item(item1).Item(item2).Item("Pond.") + du * s.Item(item1).Item(item2).Item("solde")
s.Item(item1).Item(item2).Remove "Pond."
s.Item(item1).Item(item2).Add j, "Pond."
Else
j = s.Item(item1).Item(item2).Item("Mvt") + arr(i, IBV)
s.Item(item1).Item(item2).Remove "Mvt"
s.Item(item1).Item(item2).Add j, "Mvt"
End If
j = s.Item(item1).Item(item2).Item("solde") - arr(i, IBV)
s.Item(item1).Item(item2).Remove "solde"
s.Item(item1).Item(item2).Add j, "solde"
s.Item(item1).Item(item2).Remove "date"
s.Item(item1).Item(item2).Add arr(i, IBD), "date"
End With
End Function
Function calculs_tableaux_analytiques(portefeuille, i)
With BSH
Dim dansC As Integer
dansC = 0
For Each x In c.Item(portefeuille)
If x.Item("code") = .Cells(i, IBCC) Then
dansC = 1
''''Tableaux analytiques''''
'''''''''solde''''''''''''''
j = c.Item(portefeuille).Item(.Cells(i, IBCC)).Item("solde fin")
c.Item(portefeuille).Item(.Cells(i, IBCC)).Remove "solde fin"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add j - .Cells(i, IBV), "solde fin"
'''''''''autres postes''''''
If .Cells(i, IBP) = "AACTION" Or .Cells(i, IBP) = "ASIC" Then
j = c.Item(portefeuille).Item(.Cells(i, IBCC)).Item("acquisition")
c.Item(portefeuille).Item(.Cells(i, IBCC)).Remove "acquisition"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add j - .Cells(i, IBV), "acquisition"
End If
If .Cells(i, IBP) = "VACTION" Or .Cells(i, IBP) = "VSIC" Then
j = c.Item(portefeuille).Item(.Cells(i, IBCC)).Item("cession")
c.Item(portefeuille).Item(.Cells(i, IBCC)).Remove "cession"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add j - .Cells(i, IBV), "cession"
End If
If .Cells(i, IBP) = "SCESSA" Or .Cells(i, IBP) = "ECESSA" Then
j = c.Item(portefeuille).Item(.Cells(i, IBCC)).Item("reclassement")
c.Item(portefeuille).Item(.Cells(i, IBCC)).Remove "reclassement"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add j - .Cells(i, IBV), "reclassement"
End If
' If .Cells(i, ibp) = "AUGCAPITAL" Then 'A v�rifier
' j = c.Item(portefeuille).Item(.Cells(i, ibcc)).Item("augmentation capital")
' c.Item(portefeuille).Item(.Cells(i, ibcc)).Remove "augmentation capital"
' c.Item(portefeuille).Item(.Cells(i, ibcc)).Add j - .Cells(i, ibv), "augmentation capital"
' End If
If .Cells(i, IBP) = "REDCAPITAL" Then
j = c.Item(portefeuille).Item(.Cells(i, IBCC)).Item("r�duction capital")
c.Item(portefeuille).Item(.Cells(i, IBCC)).Remove "r�duction capital"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add j - .Cells(i, IBV), "r�duction capital"
End If
''''''''''''''''''''''''''''
End If
Next x
If dansC = 0 Then
c.Item(portefeuille).Add New Collection, .Cells(i, IBCC)
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add .Cells(i, IBCC), "code"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add .Cells(i, IBCC), "nom"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "solde"
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add -.Cells(i, IBV), "solde fin"
'c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "solde fin"
If .Cells(i, IBP) = "AACTION" Or .Cells(i, IBP) = "ASIC" Then
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add -.Cells(i, IBV), "acquisition"
Else
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "acquisition"
End If
If .Cells(i, IBP) = "VACTION" Or .Cells(i, IBP) = "VSIC" Then
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add -.Cells(i, IBV), "cession"
Else
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "cession"
End If
If .Cells(i, IBP) = "SCESSA" Or .Cells(i, IBP) = "ECESSA" Then
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add -.Cells(i, IBV), "reclassement"
Else
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "reclassement"
End If
If .Cells(i, IBP) = "REDCAPITAL" Then
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add -.Cells(i, IBV), "r�duction capital"
Else
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "r�duction capital"
End If
c.Item(portefeuille).Item(.Cells(i, IBCC)).Add 0, "augmentation capital"
End If
End With
End Function
Function calcul_tableau_analytique_prets(i, valeur As Double, code As String)
Dim dansC As Integer
dansC = 0
For Each x In c
If x.Item("code") = code Then
dansC = 1
''''Tableaux analytiques''''
'''''''''solde''''''''''''''
j = c.Item(code).Item("solde fin")
c.Item(code).Remove "solde fin"
c.Item(code).Add j + valeur, "solde fin"
'''''''''autres postes''''''
If valeur > 0 Then
j = c.Item(code).Item("octroi")
c.Item(code).Remove "octroi"
c.Item(code).Add j + valeur, "octroi"
End If
If valeur < 0 Then
j = c.Item(code).Item("remboursement")
c.Item(code).Remove "remboursement"
c.Item(code).Add j + valeur, "remboursement"
End If
''''''''''''''''''''''''''''
End If
Next x
If dansC = 0 Then
c.Add New Collection, code
c.Item(code).Add code, "code"
c.Item(code).Add code, "nom"
c.Item(code).Add 0, "solde"
c.Item(code).Add valeur, "solde fin"
If valeur > 0 Then
c.Item(code).Add valeur, "octroi"
Else
c.Item(code).Add 0, "octroi"
End If
If valeur < 0 Then
c.Item(code).Add valeur, "remboursement"
Else
c.Item(code).Add 0, "remboursement"
End If
c.Item(code).Add 0, "rachat"
c.Item(code).Add 0, "conversion capital"
End If
End Function
Function correction_fin(item1, item2, sh, ligne, c, cs, cd, cp, cm, ca, cc, rl, rle)
'c: Colonne date 'cs: Colonne solde 'cd: Colonne dur�e
'cp: Colonne pond�ration 'cm: Colonne mouvement 'ca: Colonne acquisition
'cc: Colonne cession 'rl: R�cap ligne solde 'rle: R�cap ligne encours
'Recap: Dernier mois
d = s.Item(item1).Item(item2).Item("date")
RSH.Cells(rl, IRC + Month(d)) = s.Item(item1).Item(item2).Item("solde")
With sh
ligne2 = IEL + ligne
'Dur�e et solde * dur�e (tableau des encours): derni�re op�ration
du = DateSerial(Year(dd), Month(dd) + 1, 0) - CDate(d) + 1
.Cells(ligne2, cd) = du
.Cells(ligne2, cp) = du * s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cp).NumberFormat = "#,##0.00"
.Cells(ligne2, cm) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cm).NumberFormat = "#,##0.00"
If s.Item(item1).Item(item2).Item("Mvt") > 0 Then
.Cells(ligne2, cc) = s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, cc).NumberFormat = "#,##0.00"
Else
.Cells(ligne2, ca) = -s.Item(item1).Item(item2).Item("Mvt")
.Cells(ligne2, ca).NumberFormat = "#,##0.00"
End If
'Encours Derni�re op�ration
.Cells(ligne2, c) = s.Item(item1).Item(item2).Item("date")
.Cells(ligne2, cs) = s.Item(item1).Item(item2).Item("solde")
.Cells(ligne2, cs).NumberFormat = "#,##0.00"
End With
'Somme: Solde * Dur�e
j = s.Item(item1).Item(item2).Item("Pond.") + du * s.Item(item1).Item(item2).Item("solde")
s.Item(item1).Item(item2).Remove "Pond."
s.Item(item1).Item(item2).Add j, "Pond."
'Encours moyen
RSH.Cells(rle, IRC + Month(dd)) = _
s.Item(item1).Item(item2).Item("Pond.") / _
(DateSerial(Year(dd), Month(dd) + 1, 0) - (CDate("01/01/" & Year(BSH.Cells(2, IBD))) - 1))
End Function
Function correction_fin_prets(sh As Worksheet, dt As Date, valeur As Double, ligne As Integer, y)
'Recap: Dernier mois
d = s.Item("date")
RSH.Cells(IRP, IRC + Month(d)) = s.Item("solde")
With sh
ligne2 = IEL + ligne
'Dur�e et solde * dur�e (tableau des encours): derni�re op�ration
du = DateSerial(Year(dd), Month(dd) + 1, 0) - CDate(d) + 1
.Cells(ligne2, 7) = du
.Cells(ligne2, 8) = du * s.Item("solde")
.Cells(ligne2, 8).NumberFormat = "#,##0.00"
.Cells(ligne2, 3) = s.Item("Mvt")
.Cells(ligne2, 3).NumberFormat = "#,##0.00"
If s.Item("Mvt") > 0 Then
.Cells(ligne2, 4) = s.Item("Mvt")
.Cells(ligne2, 4).NumberFormat = "#,##0.00"
Else
.Cells(ligne2, 5) = -s.Item("Mvt")
.Cells(ligne2, 5).NumberFormat = "#,##0.00"
End If
'Encours Derni�re op�ration
.Cells(ligne2, 2) = s.Item("date")
.Cells(ligne2, 6) = s.Item("solde")
.Cells(ligne2, 6).NumberFormat = "#,##0.00"
End With
'Somme: Solde * Dur�e
j = s.Item("Pond.") + du * s.Item("solde")
s.Remove "Pond."
s.Add j, "Pond."
'Encours moyen
RSH.Cells(IRPE, IRC + Month(dd)) = s.Item("Pond.") / _
(DateSerial(Year(dd), Month(dd) + 1, 0) - (CDate("01/01/" & y) - 1))
'rsh.Cells(rle, irc + Month(dd)) = s.Item("Pond.") / _
(DateSerial(Year(dd), Month(dd) + 1, 0) - (CDate("01/01/" & Year(bsh.Cells(2, ibd))) - 1))
End Function
Sub trier_par_dates(sh, col)
If Not sh.AutoFilterMode Then
sh.Range("A1").AutoFilter
End If
sh.AutoFilter.Sort.SortFields.Clear
sh.AutoFilter.Sort.SortFields.Add Key _
:=Range(col + "2:" + col + "50000"), SortOn:=xlSortOnValues, order:=xlAscending, _
DataOption:=xlSortTextAsNumbers
With sh.AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'ActiveWindow.SmallScroll Down:=60
End Sub
Sub r�initialiser()
'variables
'R�initialiser la feuille 'R�cap' (champs titres)
'RSH.Range("E9:P13").ClearContents
'RSH.Range("E18:P22").ClearContents
RSH.Range(IRRE).ClearContents
RSH.Range(IRRS).ClearContents
'R�initialiser les feuille 'EM Actions', 'EM Trans' et 'EM Tx'
ASH.Cells.ClearContents
YSH.Cells.ClearContents
TSH.Cells.ClearContents
ASH.Cells.ClearFormats
YSH.Cells.ClearFormats
TSH.Cells.ClearFormats
'R�initialiser la feuille 'Tableaux analytiques'
TASH.Cells.ClearContents
TASH.Cells.ClearFormats
TASH.Cells.Interior.Color = xlNone
End Sub
Sub r�initialiser_prets()
'variables
'R�initialiser la feuille 'R�cap' (champs pr�ts)
'RSH.Range("E14:P14").ClearContents
'RSH.Range("E23:P23").ClearContents
RSH.Range(IRREP).ClearContents
RSH.Range(IRRSP).ClearContents
'R�initialiser les feuille 'EM Pr�ts'
PSH.Cells.ClearContents
PSH.Cells.ClearFormats
PSH.Cells.Interior.Color = xlNone
'R�initialiser la feuille 'Tableau Analytique Pr�ts'
TPSH.Cells.ClearContents
TPSH.Cells.ClearFormats
TPSH.Cells.Interior.Color = xlNone
End Sub
Sub optimisationD�but()
Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
'Application.Calculation = xlManual
Application.ScreenUpdating = False
End Sub
Sub optimisationFin()
Application.DisplayStatusBar = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub init_tableaux_analytiques()
'Dim titres As String * 100
Dim lignetitre As Integer
Dim arr() As Variant
Dim titres() As Variant
Const itat As Integer = 2 'Colonne titre
Const itad As Integer = 3 'Colonne solde d�but
Const itaa As Integer = 4 'Colonne acquisition
Dim itaak As Integer 'Colonne augmentation capital
Dim itar As Integer 'Colonne reclassement
Dim itark As Integer 'Colonne r�duction capital
Dim itac As Integer 'Colonne cession
Dim itasf As Integer 'Colonne solde fin
With TASH
'Dessine les tableaux analytiques (noms + codes des titres)
x = IEL - 2
For Each i In Split("TRANS PART PLACT")
'titres = "Titre,D�but,Acquisition,Reclassement,Cession,Fin"
titres = Array("Titre", "Solde D�but", "Acquisition", "Reclassement", "Cession", "Solde Fin")
'index tableaux analytiques
'itaa = 4 'Colonne acquisition
itar = 5 'Colonne reclassement
itac = 6 'Colonne cession
itasf = 7 'Colonne solde fin
If i = "PART" Then
'titres = "Titre,D�but,Acquisition,Aug. Capital,Reclassement,Red. Capital,Cession,Fin"
titres = Array("Titre", "Solde D�but", "Acquisition", "Aug. Capital", "Reclassement", "Red. Capital", "Cession", "Solde Fin")
itaak = 5 'Colonne augmentation capital
itar = 6 'Colonne reclassement
itark = 7 'Colonne r�duction capital
itac = 8 'Colonne cession
itasf = 9 'Colonne solde fin
End If
'Grand titre
.Cells(x, 2) = i 'Nom du portefeuille (titre)
' With TASH.Cells(x, 2)
' .Font.Bold = True
' .HorizontalAlignment = xlCenter
' .Interior.Color = RGB(64, 64, 64)
' .Font.Color = vbWhite
' End With
' .Range(.Cells(x, 2), .Cells(x, UBound(titres) + 2)).Merge
'Sous-titres (array)
.Range(.Cells(x + 1, 2), .Cells(x + 1, UBound(titres) + 2)) = titres
' With TASH.Range(.Cells(x + 1, 2), .Cells(x + 1, UBound(titres) + 2))
' .Font.Bold = True
' .HorizontalAlignment = xlCenter
' .Interior.Color = RGB(83, 142, 213)
' .Font.Color = vbWhite
' End With
li = 1
x = x + 2
total_debut = x
'Lignes du tableau
For Each j In c.Item(i)
.Cells(x, itat) = j.Item("nom")
.Cells(x, itad) = j.Item("solde")
.Cells(x, itasf) = j.Item("solde fin")
.Cells(x, itaa) = j.Item("acquisition")
.Cells(x, itar) = j.Item("reclassement")
.Cells(x, itac) = j.Item("cession")
If i = "PART" Then
.Cells(x, itaak) = j.Item("augmentation capital")
.Cells(x, itark) = j.Item("r�duction capital")
.Cells(x, itaak).NumberFormat = "#,##0.00"
.Cells(x, itark).NumberFormat = "#,##0.00"
End If
.Cells(x, 3).NumberFormat = "#,##0.00"
.Cells(x, itasf).NumberFormat = "#,##0.00"
.Cells(x, itaa).NumberFormat = "#,##0.00"
.Cells(x, itar).NumberFormat = "#,##0.00"
.Cells(x, itac).NumberFormat = "#,##0.00"
'If li Mod 2 = 1 Then colorer_ligne_tableau TASH, Int(x), 2, Int(itasf)
li = li + 1
x = x + 1
Next j
colorer_tableau TASH, Int(total_debut), itat, itasf
'Ajout des totaux
.Cells(x, 2) = "Total"
.Cells(x, 2).Font.Bold = True
For j = 3 To itasf
.Cells(x, j).Formula = "=sum(" + .Cells(total_debut, j).Address + ":" + .Cells(x - 1, j).Address + ")"
.Cells(x, j).Font.Bold = True
Next j
.Range(.Cells(x, 2), .Cells(x, itasf)).Interior.Color = RGB(64, 64, 64)
.Range(.Cells(x, 2), .Cells(x, itasf)).Font.Color = vbWhite
x = x + 2
Next i
End With
End Sub
Sub init_tableau_analytique_prets()
Const itate As Integer = 2 'Colonne titre emprunteur
Const itasd As Integer = 3 'Colonne solde d�but
Const itacc As Integer = 4 'Colonne conversion en capital
Const itanp As Integer = 5 'Colonne nouveaux pr�ts
Const itare As Integer = 6 'Colonne remboursements
Const itara As Integer = 7 'Colonne rachats
Const itasf As Integer = 8 'Colonne solde fin
With TPSH
x = IEL - 2
titres = Array("Emprunteur", "Solde D�but", "Conversion en Capital", "Nouveaux Pr�ts", "Remboursements", "Rachat", "Solde Fin")
.Cells(x, itate) = "PRETS" 'Nom du portefeuille (titre)
.Range(.Cells(x + 1, itate), .Cells(x + 1, UBound(titres) + itate)) = titres
x = x + 2
total_debut = x
'Lignes du tableau
For Each j In c
.Cells(x, itate) = j.Item("nom")
.Cells(x, itasd) = j.Item("solde")
.Cells(x, itasf) = j.Item("solde fin")
.Cells(x, itanp) = j.Item("octroi")
.Cells(x, itare) = j.Item("remboursement")
.Cells(x, itara) = j.Item("rachat")
.Cells(x, itacc) = j.Item("conversion capital")
.Cells(x, itasd).NumberFormat = "#,##0.00"
.Cells(x, itasf).NumberFormat = "#,##0.00"
.Cells(x, itanp).NumberFormat = "#,##0.00"
.Cells(x, itare).NumberFormat = "#,##0.00"
.Cells(x, itara).NumberFormat = "#,##0.00"
.Cells(x, itacc).NumberFormat = "#,##0.00"
x = x + 1
Next j
colorer_tableau TPSH, Int(total_debut), itate, itasf
'Ajout des totaux
.Cells(x, 2) = "Total"
.Cells(x, 2).Font.Bold = True
For j = 3 To itasf
.Cells(x, j).Formula = "=sum(" + .Cells(total_debut, j).Address + ":" + .Cells(x - 1, j).Address + ")"
.Cells(x, j).Font.Bold = True
Next j
.Range(.Cells(x, 2), .Cells(x, itasf)).Interior.Color = RGB(64, 64, 64)
.Range(.Cells(x, 2), .Cells(x, itasf)).Font.Color = vbWhite
End With
End Sub
Sub encours_prets_2()
'''' Enlever le commentaire pour les tests ''''
'variables
'''''''''''''''''''''''''''''''''''''''''''''''
trier_par_dates BPSH, "E"
'Dates d�but et fin
dd = CDate(RSH.Range(IRPDD).Value)
df = CDate(RSH.Range(IRPDF).Value)
'D�termine l'ann�e de base (peut g�n�rer des bugs)
Dim y As Integer
'y = Year(bpsh.Cells(2, ipbr)) 'Peut g�n�rer un bug s'il n'y a que des pr�ts lin�aires avec des dates diff�rentes de l'an�e actuelle)
y = Year(dd)
'Collection d'op�rations
Set o = New Collection
'Collection tableau analytique
Set c = New Collection
'Cr�e le contenant des calculs
Set s = New Collection
s.Add CDate("01/01/" & y), "date" 'Date
s.Add 0, "Mvt" 'Mouvement
s.Add 0, "Pond." 'Solde * Dur�e
'Solde de d�part
With SSH
i = ISC
Do Until IsEmpty(.Cells(ISL, i))
If y - 1 = .Cells(ISL, i) Then s.Add .Cells(ISLP, i), "solde"
i = i + 1
Loop
End With
'Cherche les soldes de d�part du tableau analytique
With SSH
'Cherche la colonne correspondante � l'ann�e de base dans le tableau des soldes
i = isac
Do Until IsEmpty(.Cells(ISAL, i))
If y - 1 = .Cells(ISAL, i) Then isac = i
i = i + 1
Loop
'Compile la liste des pr�ts
i = ISAL + 1
Do Until IsEmpty(.Cells(i, ISACN))
If .Cells(i, ISACP) = "PRETS" Then
c.Add New Collection, .Cells(i, ISACC)
c.Item(.Cells(i, ISACC)).Add .Cells(i, ISACC), "code"
c.Item(.Cells(i, ISACC)).Add .Cells(i, ISACN), "nom"
c.Item(.Cells(i, ISACC)).Add .Cells(i, isac), "solde"
c.Item(.Cells(i, ISACC)).Add .Cells(i, isac), "solde fin"
c.Item(.Cells(i, ISACC)).Add 0, "octroi"
c.Item(.Cells(i, ISACC)).Add 0, "remboursement"
c.Item(.Cells(i, ISACC)).Add 0, "rachat"
c.Item(.Cells(i, ISACC)).Add 0, "conversion capital"
End If
i = i + 1
Loop
End With