1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Public Function Cherche_valeur(ByVal Table As Range, ByVal Valeur As Range, Decal As Long)
Dim Rng1 As Range
Dim i As Integer
Set Rng1 = Table.Find(Valeur.Value, , xlValues, xlWhole, xlByRows, xlNext, False, False)
If Rng1 Is Nothing Then
Cherche_valeur = "0"
Exit Function
End If
For i = 0 To 10 'je me donne 10 lignes pour trouver une couleur identique - à changer selon
If Range("A" & Rng1.Row).Offset(i, Decal).Interior.Color <> 16777215 Then 'Couleur autre que Automatique
Cherche_valeur = Range("A" & Rng1.Row).Offset(i, Decal).Value
Exit Function
End If
Next
End Function |