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
| Sub color()
Dim cell As Range
Dim derc%
Dim derl%
Dim r As Integer
derc = Worksheets("GMD").Cells(2, Columns.Count).End(xlToLeft).Column
derl = Worksheets("GMD").Cells(Rows.Count, 2).End(xlUp).Row
At = Cells(7, derc).Address
doc_figé = Worksheets("gmd").Range("A1:At" & 5).Value
tableau = doc_figé
recherche = "Figé"
r = array_pos(tableau, recherche)
If r <> -1 Then
Cells(4, r).EntireColumn.Interior.ColorIndex = 15
End If
End Sub
Function array_pos(tableau, recherche)
array_pos = -1
For i = LBound(tableau, 2) To UBound(tableau, 2)
If tableau(4, i) = recherche Then 'Si valeur trouvée
array_pos = i
End If
Next
End Function |