Greetings
Below Code for Lighten RGB How get Darken RGB?
THX
Below Code for Lighten RGB How get Darken RGB?
Code:
[B]Sub lightenRGB()[/B]
Dim I As Integer, Rng As Range
Dim R As Byte, G As Byte, B As Byte
Set Rng = Selection
With Rng.Cells(1).Interior
R = .Color Mod 256
G = .Color \ 256 Mod 256
B = .Color \ (CLng(256) * 256)
End With
For I = 2 To Rng.Cells.Count
With Rng.Cells(I).Interior
.Color = RGB(R + (255 - R) * (I - 1) / (Rng.Cells.Count - 1), G + (255 - G) * (I - 1) / (Rng.Cells.Count - 1), B + (255 - B) * (I - 1) / (Rng.Cells.Count - 1))
End With
Next I
End Sub
THX