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
| Public Function TableVertRange(Ra As Range, Optional R As Integer = 240, Optional G As Integer = 240, Optional B As Integer = 240, Optional StartShade As Integer = 1, Optional VertBord As Boolean = True) As Integer
StartShade = (StartShade + 1) Mod 2 'si on fait deux tableaux à la suite, la couleur de départ de celui ci est l'inverse de la couleur de fin du précédent
With Ra
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeTop)
End With
With .Borders(xlEdgeBottom)
End With
With .Borders(xlEdgeLeft)
If VertBord Then
.LineStyle = xlContinuous
.color = RGB(255, 255, 255)
.TintAndShade = 0
.weight = xlMedium
Else
.LineStyle = xlNone
End If
End With
With .Borders(xlEdgeRight)
If VertBord Then
.LineStyle = xlContinuous
.color = RGB(255, 255, 255)
.TintAndShade = 0
.weight = xlMedium
Else
.LineStyle = xlNone
End If
End With
With .Borders(xlInsideVertical)
If VertBord Then
.LineStyle = xlContinuous
.color = RGB(255, 255, 255)
.TintAndShade = 0
.weight = xlMedium
Else
.LineStyle = xlNone
End If
End With
.Borders(xlInsideHorizontal).LineStyle = xlNone
'For Ro = .Row To .Row + .Rows.Count - 1
For Ro = 1 To .Rows.Count
Dim alpha As Double
'alpha = 1 - ((Ro - .Row + StartShade) Mod 2) * 0.05
alpha = 1 - ((Ro - 1 + StartShade) Mod 2) * 0.05
'Call ColorRange(Range(Cells(Ro, c1.Column), Cells(Ro, c2.Column)), RGB(R * alpha, G * alpha, B * alpha))
'Call ColorRange(.Worksheet.Range(Cells(Ro, .Column), Cells(Ro, .Column + .Columns.Count - 1)), RGB(R * alpha, G * alpha, B * alpha))
Call ColorRange(.Rows(Ro), RGB(R * alpha, G * alpha, B * alpha))
Next Ro
TableVertRange = (.Rows.Count - 1 + StartShade) Mod 2
End With
End Function |
Partager