Couleur bouton selon valeur cellule
Résolu
surplus
Messages postés
673
Date d'inscription
Statut
Membre
Dernière intervention
-
surplus Messages postés 673 Date d'inscription Statut Membre Dernière intervention -
surplus Messages postés 673 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai un soucis avec un "CommandButton" je lui modifie le texte selon la valeur d'une Cellule D1
qui me donne "FACTURE" ou "DEVIS" selon la valeur de D1
Mais je voudrais lui changer la couleur Rouge ou vert et je bloque je vous mets la macro
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
Range("D1") = "FACTURE" = CommandButton1.BackColor = RGB(255, 0, 0)
'Range("D1") = "DEVIS" = CommandButton1.BackColor = RGB(200, 0, 0)
End Sub
Merci de votre aide
Slts A bientôt
Surplus
j'ai un soucis avec un "CommandButton" je lui modifie le texte selon la valeur d'une Cellule D1
qui me donne "FACTURE" ou "DEVIS" selon la valeur de D1
Mais je voudrais lui changer la couleur Rouge ou vert et je bloque je vous mets la macro
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
Range("D1") = "FACTURE" = CommandButton1.BackColor = RGB(255, 0, 0)
'Range("D1") = "DEVIS" = CommandButton1.BackColor = RGB(200, 0, 0)
End Sub
Merci de votre aide
Slts A bientôt
Surplus
A voir également:
- Couleur bouton selon valeur cellule
- Excel cellule couleur si condition texte - Guide
- Bouton couleur telecommande - Guide
- Excel somme si couleur cellule - Guide
- Vba récupérer valeur cellule ✓ - Forum VB / VBA
- Excel si couleur cellule alors ✓ - Forum Excel
2 réponses
Bonjour,
Comme cela
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
If Range("D1") = "FACTURE" Then CommandButton1.BackColor = RGB(255, 0, 0)
If Range("D1") = "DEVIS" Then CommandButton1.BackColor = RGB(200, 0, 0)
End Sub
ou encore comme cela
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
If Range("D1") = "FACTURE" Then CommandButton1.BackColor = &HFF&
If Range("D1") = "DEVIS" Then CommandButton1.BackColor = &HC8&
End Sub
A+
Mike-31
Une période d'échec est un moment rêvé pour semer les graines du savoir.
Comme cela
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
If Range("D1") = "FACTURE" Then CommandButton1.BackColor = RGB(255, 0, 0)
If Range("D1") = "DEVIS" Then CommandButton1.BackColor = RGB(200, 0, 0)
End Sub
ou encore comme cela
Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Caption = Range("D1")
If Range("D1") = "FACTURE" Then CommandButton1.BackColor = &HFF&
If Range("D1") = "DEVIS" Then CommandButton1.BackColor = &HC8&
End Sub
A+
Mike-31
Une période d'échec est un moment rêvé pour semer les graines du savoir.