Bonjour,
Je sais colorer les bordures d'une cellule en ROUGE, EN JAUNE,... mais je voudrais bien les colorer en GRIS, même couleur que je colore le fond de la cellule dans le code ci-dessous. Le GRIS du fond est obtenu via l'enregistrement d'une macro.
Est-ce possible ? Si oui, comment ?
Sub ColorerCell(Adr$, coul$) ActiveSheet.Range(Adr).Select Select Case UCase(Left(coul, 4)) Case Is = "BLAN": With Selection.Interior: .Pattern = xlSolid: .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1: .TintAndShade = 0: .PatternTintAndShade = 0: End With Case Is = "NOIR": With Selection.Interior: .Pattern = xlSolid: .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorLight1: .TintAndShade = 0: .PatternTintAndShade = 0: End With Case Is = "JAUN": With Selection.Interior: .Pattern = xlSolid: .PatternColorIndex = xlAutomatic .Color = 65535: .TintAndShade = 0: .PatternTintAndShade = 0: End With: Case Is = "GRIS": With Selection.Interior: .Pattern = xlSolid: .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1: .TintAndShade = -0.249977111117893: .PatternTintAndShade = 0: End With Case Is = "ROUG": With Selection.Interior: .Pattern = xlSolid: .PatternColorIndex = xlAutomatic .Color = 255: .TintAndShade = 0: .PatternTintAndShade = 0: End With End Select: End Sub
Sub ColorerCadre(ByVal X$, ByVal Koul$) ' colore les 4 côtés de la case Dim coul As Double Select Case UCase(Left(Koul, 4)) Case Is = "BLAN": coul = vbWhite '0 Case Is = "NOIR": coul = vbBlack '1 Case Is = "JAUN": coul = vbYellow '6 ' Case Is = "GRIS": coul = ? Case Else: Info " ColorerCadre erreur couleur !" End Select: Range(X).Select With Selection: ' .Borders(xlDiagonalDown).LineStyle = xlNone: .Borders(xlDiagonalUp).LineStyle = xlNone With .Borders(xlEdgeLeft): .LineStyle = xlContinuous: .ColorIndex = coul: .TintAndShade = 0: .Weight = xlThin: End With With .Borders(xlEdgeTop): .LineStyle = xlContinuous: .ColorIndex = coul: .TintAndShade = 0: .Weight = xlThin: End With With .Borders(xlEdgeBottom): .LineStyle = xlContinuous: .ColorIndex = coul: .TintAndShade = 0: .Weight = xlThin: End With With .Borders(xlEdgeRight): .LineStyle = xlContinuous: .ColorIndex = coul: .TintAndShade = 0: .Weight = xlThin: End With: End With: End Sub
Bonjour,
Je ne te comprends pas.
Donner aux bordures d'une cellule la couleur de fond de cette cellule revient tout simplement à ne pas donner de bordure, ainsi (exemple)
With Range("B11") With .Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = -0.249977111117893 .PatternTintAndShade = 0 End With .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlNone .Borders(xlEdgeTop).LineStyle = xlNone .Borders(xlEdgeBottom).LineStyle = xlNone .Borders(xlEdgeRight).LineStyle = xlNone .Borders(xlInsideVertical).LineStyle = xlNone .Borders(xlInsideHorizontal).LineStyle = xlNone End With
Salut. tu as raison, je deviens sénile.
Axé (obnubilé plutôt) par un routine permettant de colorer les bords, j'ai oublier que l'absence de bords m'assurer de mon besoin.
Désolé de t'avoir sollicité pour si peu, mais tu m'as quand rendu service et donc MERCI.
Bab
Axé (obnubilé plutôt) par un routine permettant de colorer les bords, j'ai oublier que l'absence de bords m'assurer de mon besoin.
Désolé de t'avoir sollicité pour si peu, mais tu m'as quand rendu service et donc MERCI.
Bab