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
| Sub ColorTout1()
Dim c As Range
Dim a As Integer
Dim b As Integer
Dim VNJ As Integer
'Dim NJm As Integer
'a est le nb de lignes précédent le modèle
a = 5
'b est le N° de colonne du modèle
b = 16
For Each c In Range("G10:G35")
'Cells(c.Row, 2).Offset(-1, 0).Value = NJm
VNJ = Cells(c.Row, 2).Value
If VNJ = 7 Then
ElseIf VNJ = 6 And Cells(c.Row, 2).Offset(-1, 0).Value = 6 Then
ElseIf Cells(c.Row, 2).Offset(-1, 0).Value = VNJ Then
' Cells((Cells(c.Row, 2).Value) * 2 + a, b).Select
c.Value = Cells(VNJ * 2 + a, b).Value
c.Interior.ColorIndex = Cells(VNJ * 2 + a, b).Interior.ColorIndex
c.Font.ColorIndex = Cells(VNJ * 2 + a, b).Font.ColorIndex
c.Font.FontStyle = Cells(VNJ * 2 + a, b).Font.FontStyle
c.Font.Name = Cells(VNJ * 2 + a, b).Font.Name
c.Font.Size = Cells(VNJ * 2 + a, b).Font.Size
c.Font.Underline = Cells(VNJ * 2 + a, b).Font.Underline
Else
' Cells((Cells(c.Row, 2).Value - 1) * 2 + 1 + a, b).Select
c.Value = Cells((Cells(c.Row, 2).Value - 1) * 2 + 1 + a, b).Value
c.Interior.ColorIndex = Cells((VNJ - 1) * 2 + 1 + a, b).Interior.ColorIndex
c.Font.ColorIndex = Cells((VNJ - 1) * 2 + 1 + a, b).Font.ColorIndex
c.Font.FontStyle = Cells((VNJ - 1) * 2 + 1 + a, b).Font.FontStyle
c.Font.Name = Cells((VNJ - 1) * 2 + 1 + a, b).Font.Name
c.Font.Size = Cells((VNJ - 1) * 2 + 1 + a, b).Font.Size
c.Font.Underline = Cells((VNJ - 1) * 2 + 1 + a, b).Font.Underline
End If
Next c
End Sub |
Partager