Question toute bête
a
rebonjour le forum
Question toute bête j'aimerais que mon code quand il colle mes donnée sur le feuille 4 je voudrais qu'il commence a partir de la première ligne et non pas de la 2 eme
voii mon code qui ne commance pas a la premiere ligne
Sub NOMBRE_DE_SINISTRES_DECLARES()
Dim Date_Souscription_Adhésion As Range, Date_Survenance As Range
Dim DernLigne As Long
Dim nblignes(1 To 12, 2015 To 2017) As Long
Dim i, j, k As Integer
Dim a, b, c, d, e As Integer
With Worksheets("Sinistre")
DernLigne = .Range("A" & .Rows.Count).End(xlUp).Row
Set Date_Souscription_Adhésion = .Range("G2:G" & DernLigne)
Set Date_Survenance = .Range("U2:U" & DernLigne)
End With
a = LBound(nblignes, 2)
e = UBound(nblignes, 2)
For i = 2 To DernLigne
If a <= Year(Cells(i, 21).Value) And Year(Cells(i, 21).Value) <= e Then
j = Month(Cells(i, 7).Value)
k = Year(Cells(i, 7).Value)
nblignes(j, k) = nblignes(j, k) + 1
End If
Next i
For i = 1 To 12
For k = a To e
Sheets("Feuil4").Cells(i + 1 + (k - 2015) * 12, 3).Value = nblignes(i, k)
Next k
Next i
End Sub
et voici un autre code qui commence a la première ligne
Sub MONTANT_INDEMNITE_PRINCIPALE()
Dim Date_Souscription_Adhésion As Range, Statut_Technique_Sinistre As Range
Dim Montant_Ind_Principale As Range
Dim DernLigne As Long
Dim i As Integer
Dim sa As String
Dim montant As String
Dim tt(2015 To 2017, 1 To 12) As Double
'tmois = Split("janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre", ",")
With Worksheets("Sinistre")
DernLigne = .Range("A" & .Rows.Count).End(xlUp).Row
Set Date_Souscription_Adhésion = .Range("G2:G" & DernLigne)
Set Montant_Ind_Principale = .Range("AB2:AB" & DernLigne)
Set Statut_Technique_Sinistre = .Range("V2:V" & DernLigne)
For i = 2 To DernLigne
sa = .Cells(i, 22)
montant = Replace(.Cells(i, 28), ".", ",")
annee = Year(.Cells(i, 7).Value)
Mois = Month(.Cells(i, 7))
If sa <> "Terminé - Refusé après instruction" Then
tt(annee, Mois) = tt(annee, Mois) + CDbl(montant)
End If
Next i
For annee = 2015 To 2017
For Mois = 1 To 12
j = j + 1
' Sheets("Feuil2").Cells(j, 2).Value = tmois(Mois - 1) & " " & annee
Sheets("Feuil4").Cells(j, 6).Value = tt(annee, Mois)
Next Mois
Next annee
End With
merci pour votre aide
bonjour ,
une possibilité
Sheets("Feuil4").Cells(i + (k - 2015) * 12, 3).Value = nblignes(i, k)
a
SUPER c'étais bien ça merciiii