Dégradé de couleur

Hello,

Je cherche a recréer un dégradé de couleur sur plusieurs cellules, qui ne dépend pas de la valeur des cellules (cf. fichier joint). Savez-vous comment la personne a pu faire celui-ci ? (je suis sur Mac)

Merci d'avance x)

17degrade.xlsx (9.09 Ko)

Bonjour,

Sans VBA je ne vois pas trop comment faire, avec VBA on peut faire ça:

21degrader.xlsm (23.84 Ko)

Procédure principale:

Sub degrader()
Dim couleurDep As Long, couleurFin As Long
Dim couleurDepRGB As Variant, couleurFinRGB As Variant, variation(1 To 3) As Variant
Dim nbCel As Integer

couleurDep = Range("depart").Interior.Color
couleurFin = Range("fin").Interior.Color
nbCel = Range("nbCel")
couleurDepRGB = getRGB(couleurDep)
couleurFinRGB = getRGB(couleurFin)

For i = 1 To 3
    variation(i) = (couleurFinRGB(i) - couleurDepRGB(i)) / (nbCel - 1)
Next i

For a = 1 To nbCel
    Cells(3, 1 + a).Interior.Color = RGB(CInt(couleurDepRGB(1) + variation(1) * (a - 1)), CInt(couleurDepRGB(2) + variation(2) * (a - 1)), _
    CInt(couleurDepRGB(3) + variation(3) * (a - 1)))
Next a
End Sub

Fonction pour obtenir le code RGB d'une couleur:

Function getRGB(ByVal couleur As Long) As Variant
Dim tableau(1 To 3)

tableau(3) = Int(couleur / 65536)
couleur = couleur - tableau(3) * 65536
tableau(2) = Int(couleur / 256)
couleur = couleur - tableau(2) * 256
tableau(1) = couleur

getRGB = tableau
End Function
Rechercher des sujets similaires à "degrade couleur"