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
|
Public Sub Sinistre_Decl()
Dim Nombre_Sinistre_Declare As Integer
Dim Date_Souscription_Adhésion As Range
Dim Numéro_Police As Range
Dim Date_Survenance As Range
Dim Somme As Long
Dim nblignes As Integer
Dim i As Integer
Dim j As Integer
Worksheets("Feuil1").Activate
DernLigne1 = Sheets("Feuil1").Range("G" & Rows.Count).End(xlUp).Row 'définit la dernière ligne colonne A
DernLigne2 = Sheets("Feuil1").Range("R" & Rows.Count).End(xlUp).Row 'définit la dernière ligne colonne B
Set Date_Souscription_Adhésion = Sheets("Feuil1").Range("G2:G" & DernLigne1) 'définit la colonne A
Set Date_Survenance = Sheets("Feuil1").Range("R2:R" & DernLigne2) 'définit la colonne B
For i = 1 To Date_Souscription_Adhésion.Rows.Count 'boucle sur la colonne G
For j = 1 To Date_Survenance.Rows.Count 'boucle sur la colonne U
If Year(Date_Souscription_Adhésion(i, 7)) = 2016 And Month(Date_Souscription_Adhésion(i, 7)) = 4 Then
If Year(Date_Survenance(j, 21)) = 2016 And Month(Date_Survenance(j, 21)) = 9 Then
nblignes1 = nblignes1 + 1
MsgBox "nombre de ligne " & nblignes1
End If
If Year(Date_Survenance(j, 21)) = 2013 And Month(Date_Survenance(j, 21)) = 2 Then
nblignes = nblignes + 1
End If
'faire pour tt les mois
End If
'copier les données de la cellule qui verifie la condition
If Year(Date_Souscription_Adhésion(i, 7)) = 2013 And Month(Date_Souscription_Adhésion(i, 7)) = 2 Then
If Year(Date_Survenance(j, 21)) = 2013 And Month(Date_Survenance(j, 21)) = 1 Then
nblignes3 = nblignes3 + 1
End If
If Year(Date_Survenance(j, 21)) = 2013 And Month(Date_Survenance(j, 21)) = 2 Then
nblignes4 = nblignes4 + 1
End If
'faire pour tt les mois
End If
Next j
Next i
'Worksheets("Feuil2").Activate
'resultat
'on fait la mm chose avec les autres mois
End Sub |
Partager