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
|
Dim line As Single
Dim ilig As Integer 'Compteur de ligne
Dim LastLig As Long
Dim sh As Worksheet
Dim sh2 As Worksheet
Dim Plage As Range
Dim Resultat() As String
Dim i As Integer, j As Integer
ilig = 5
While InStr(1, sh2.Cells(ilig, 1), sh.Cells(icol, 1)) = 0
ilig = ilig + 1
Wend
'compteur nombre de ligne avant transaction suivante
iligarb = 0
While sh2.Cells(ilig + 1 + iligarb, 1) = ""
iligarb = iligarb + 1
Wend
'compteur nombre de hub en colonne 3
numhub = 0
For ihub = ilig + 2 To ilig + iligarb
If sh2.Cells(ihub, 3) <> "" Then
numhub = numhub + 1
Else
End If
Next ihub
ilig = ilig + 1
For i = 1 To numhub
ilig2 = 1
ilig = ilig + 1
While sh2.Cells(ilig + 1, 4) <> "" And sh2.Cells(ilig + 1, 3) = ""
'ilig2 compteur de date dans un hub Nbre de ligne dans paquet >1
ilig2 = ilig2 + 1
ilig = ilig + 1
Wend
Resultat(1, i) = i
Resultat(2, i) = ilig2
Next i
test = 0
ilig = ilig - numhub + 2
ilig3 = ilig
For i = 1 To numhub
If WorksheetFunction.Sum(sh2.Range("F" & ilig3 & ":G" & ilig3 + Resultat(2, i))) = 0 Then
test = test + 1
ilig3 = ilig3 + Resultat(2, i) + 1
End If
Next i
If test = numhub Then
sh.Cells(icol, 140) = "xxx"
Else
End If
test = 0
ilig4 = ilig
For i = 1 To iligarb - 1
If sh2.Cells(ilig4 + i - 1, 4) = sh2.Cells(ilig4 + i, 4) And sh2.Cells(ilig4 + i - 1, 5) = sh2.Cells(ilig4 + i, 5) Then
test = test + 1
End If
Next i
If test = iligarb - 1 Then
sh.Cells(icol, 140) = "xxxxxxx"
Else
sh.Cells(icol, 140) = "xxxxxxxxxxxxxx"
End If |
Partager