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
|
'Parcours des lignes pour chercher les fresques
Dim debutFresque As Integer
debutFresque = -1
Dim finFresque As Integer
Dim ligneNewFresque As Integer
ligneNewFresque = 2
Dim feuille As Worksheet
Set feuille = Application.Worksheets("Synthèse")
Dim duree As Integer
'Parcours des lignes
For i = 2 To Me.UsedRange.Rows.Count + 1
'si on tombe sur un debut ou une fin de fresque
If (StrComp(Me.Cells(i, "B").Text, "", vbTextCompare) = 0) Then
'on est sur le debut de la premiere
If (debutFresque < 0) Then
debutFresque = i
'on est sur la fin de la premiere ou sur le debut ou la fin des suivantes
Else
finFresque = i
ligneNewFresque = ligneNewFresque + 1
'Ajout d'une ligne dans la synthese pour la fresque
'ou utilisation de la 3eme ligne pour la premiere fresque
If (ligneNewFresque > 3) Then
feuille.Rows(ligneNewFresque).Insert
End If
Dim lang
Dim somme As String
lang = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
If (lang = 1067 Or lang = 1033 Or lang = 2057) Then
somme = "SUM"
ElseIf (lang = 1036) Then
somme = "SOMME"
End If
'sommes des projectiles par calibre
Dim nom As String
nom = Me.Cells(debutFresque, "E").Text
If (InStr(1, nom, "#", vbTextCompare)) Then
nom = Left(nom, InStr(1, nom, "#", vbTextCompare) - 1)
End If
feuille.Cells(ligneNewFresque, "A").Value = nom
feuille.Cells(ligneNewFresque, "B").Value = "=" & somme & "(Quantitatif!W" & CStr(debutFresque + 1) & ":Quantitatif!W" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "C").Value = "=" & somme & "(Quantitatif!X" & CStr(debutFresque + 1) & ":Quantitatif!X" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "D").Value = "=" & somme & "(Quantitatif!Y" & CStr(debutFresque + 1) & ":Quantitatif!Y" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "E").Value = "=" & somme & "(Quantitatif!Z" & CStr(debutFresque + 1) & ":Quantitatif!Z" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "F").Value = "=" & somme & "(Quantitatif!AA" & CStr(debutFresque + 1) & ":Quantitatif!AA" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "G").Value = "=" & somme & "(Quantitatif!AB" & CStr(debutFresque + 1) & ":Quantitatif!AB" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "H").Value = "=" & somme & "(Quantitatif!AC" & CStr(debutFresque + 1) & ":Quantitatif!AC" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "I").Value = "=" & somme & "(Quantitatif!AD" & CStr(debutFresque + 1) & ":Quantitatif!AD" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "J").Value = "=" & somme & "(Quantitatif!AE" & CStr(debutFresque + 1) & ":Quantitatif!AE" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "K").Value = "=" & somme & "(Quantitatif!AF" & CStr(debutFresque + 1) & ":Quantitatif!AF" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "L").Value = "=" & somme & "(Quantitatif!AG" & CStr(debutFresque + 1) & ":Quantitatif!AG" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "M").Value = "=" & somme & "(Quantitatif!AH" & CStr(debutFresque + 1) & ":Quantitatif!AH" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "N").Value = "=" & somme & "(Quantitatif!AI" & CStr(debutFresque + 1) & ":Quantitatif!AI" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "O").Value = "=" & somme & "(Quantitatif!AJ" & CStr(debutFresque + 1) & ":Quantitatif!AJ" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "P").Value = "=" & somme & "(Quantitatif!AK" & CStr(debutFresque + 1) & ":Quantitatif!AK" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "Q").Value = "=" & somme & "(Quantitatif!AL" & CStr(debutFresque + 1) & ":Quantitatif!AL" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "R").Value = "=" & somme & "(Quantitatif!AM" & CStr(debutFresque + 1) & ":Quantitatif!AN" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "S").Value = "=" & somme & "(Quantitatif!AO" & CStr(debutFresque + 1) & ":Quantitatif!AP" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "T").Value = "=" & somme & "(Quantitatif!AQ" & CStr(debutFresque + 1) & ":Quantitatif!AR" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "U").Value = "=" & somme & "(Quantitatif!AS" & CStr(debutFresque + 1) & ":Quantitatif!AT" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "V").Value = "=" & somme & "(Quantitatif!AU" & CStr(debutFresque + 1) & ":Quantitatif!AV" & CStr(finFresque - 1) & ")"
feuille.Cells(ligneNewFresque, "W").Value = "=" & somme & "(Quantitatif!AW" & CStr(debutFresque + 1) & ":Quantitatif!AW" & CStr(finFresque - 1) & ")"
'somme de la MA
feuille.Cells(ligneNewFresque, "Y").Value = "=" & somme & "(Quantitatif!Q" & CStr(debutFresque + 1) & ":Quantitatif!Q" & CStr(finFresque - 1) & ")"
'minutage de la fresque
deb = Me.Cells(debutFresque + 1, "B").Text ' 02min33s
If (Not InStr(deb, "Hors")) Then
deb = Left(deb, Len(deb) - 1) 'on enleve s
If (StrComp(Me.Cells(finFresque + 1, "B").Text, "", vbTextCompare) <> 0) Then
fin = Me.Cells(finFresque + 1, "B").Text 'on recupere le time du debut de la fresque suivante
Else
fin = Me.Cells(finFresque - 1, "B").Text 'on recupere le time du debut de la fresque suivante
duree = duree + 5
End If
fin = Left(fin, Len(fin) - 1)
duree = duree + (Val(Left(fin, 2)) * 60 + Val(Right(fin, 2))) - (Val(Left(deb, 2)) * 60 + Val(Right(deb, 2))) + 1
End If
If (duree > 0) Then
feuille.Cells(ligneNewFresque, "X").Value = duree
duree = -1
End If
debutFresque = finFresque
End If
End If
Next i |
Partager