Sub dudule()
Dim tab1 'Crée une variable
Set tab1 = CreateObject("Scripting.Dictionary")
Sheets("Fluidics").Select
l = 1
ya = 2
While ya <> 0
tmp = Cells(l, 2)
If tmp = "" Then
ya = ya - 1
Else
ya = 2
End If
If ya > 0 Then
If Left(tmp, 1) = "@" Then
tab1(tmp) = Array(Cells(l - 3, 6), "")
End If
End If
l = l + 1
Wend
'--------------------------------------------------
' feuille scan
'--------------------------------------------------
Sheets("Scan").Select
l = 1
ya = 4
While ya <> 0
tmp = Cells(l, 2)
If tmp = "" Then
ya = ya - 1
Else
ya = 4
End If
If ya > 0 Then
If Left(tmp, 1) = "@" Then
If tab1.exists(tmp) Then
tmp1 = tab1(tmp)
tmp1(1) = Cells(l + 1, 2)
tab1(tmp) = tmp1
Else
tab1(tmp) = Array("", Cells(l + 1, 2))
End If
End If
End If
l = l + 1
Wend
'--------------------------------------------------
' ecriture resultat
'--------------------------------------------------
Sheets("calculs").Select
l = 10
For Each cle In tab1
Cells(l, 1) = cle
tmp1 = tab1(cle)
Cells(l, 2) = tmp1(0)
Cells(l, 3) = tmp1(1)
If tmp1(1) <> "" Then Cells(l, 4) = tmp1(1) - tmp1(0)
l = l + 1
Next
End Sub