Combiner 2 macros
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 2 macros dans la feuille
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$8" Then
If Target Is Nothing Then Exit Sub '<= 7 Then Exit Sub
If Target > 7 Then MsgBox "ID Commerçant 7 caractères": Application.Undo
End If
If Target.Address = "$H$6" Then
If Target.Value = "En Cours" Then
ActiveSheet.Tab.ColorIndex = 35
Else
If Target.Value = "Attente Action" Then
ActiveSheet.Tab.Color = RGB(255, 0, 0)
Else
If Target.Value = "Cloturé" Then
ActiveSheet.Tab.Color = RGB(39, 82, 18)
End If
End If
End If
End If
End Sub
mais elles ne fonctionne pas les 2 ensemble comment combiner les 2?
fichier exemple
https://www.cjoint.com/c/KFgriU7tcoe
merci
Slts A bientôt
Surplus
j'ai 2 macros dans la feuille
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$8" Then
If Target Is Nothing Then Exit Sub '<= 7 Then Exit Sub
If Target > 7 Then MsgBox "ID Commerçant 7 caractères": Application.Undo
End If
If Target.Address = "$H$6" Then
If Target.Value = "En Cours" Then
ActiveSheet.Tab.ColorIndex = 35
Else
If Target.Value = "Attente Action" Then
ActiveSheet.Tab.Color = RGB(255, 0, 0)
Else
If Target.Value = "Cloturé" Then
ActiveSheet.Tab.Color = RGB(39, 82, 18)
End If
End If
End If
End If
End Sub
mais elles ne fonctionne pas les 2 ensemble comment combiner les 2?
fichier exemple
https://www.cjoint.com/c/KFgriU7tcoe
merci
Slts A bientôt
Surplus
A voir également:
- Combiner 2 macros
- Supercopier 2 - Télécharger - Gestion de fichiers
- 2 ecran pc - Guide
- Combiner pdf - Guide
- Combiner 2 cellules excel - Guide
- Faire 2 colonnes sur word - Guide
3 réponses
Bonjour,
Essayez ceci
Cdlt
Essayez ceci
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo Sortie Application.EnableEvents = False If Target.Address = "$C$8" Then If Not Target Is Nothing And Len(Target) > 7 Then MsgBox "ID Commerçant 7 caractères" Application.Undo End If End If If Target.Address = "$H$6" Then If Target.Value = "En Cours" Then ActiveSheet.Tab.ColorIndex = 35 ElseIf Target.Value = "Attente Action" Then ActiveSheet.Tab.Color = RGB(255, 0, 0) ElseIf Target.Value = "Cloturé" Then ActiveSheet.Tab.Color = RGB(39, 82, 18) End If End If Sortie: Application.EnableEvents = True End Sub
Cdlt
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$8" Then
If Target Is Nothing Then Exit Sub '<= 7 Then Exit Sub
If Target > 7 Then MsgBox "ID Commerçant 7 caractères": Application.Undo
End If
qui me limite la cellule C8 a 7 caracteres
et l'autre qui me change la couleur de l'onglet suivant la valeur de H6
If Target.Address = "$H$6" Then
If Target.Value = "En Cours" Then
ActiveSheet.Tab.ColorIndex = 35
Else
If Target.Value = "Attente Action" Then
ActiveSheet.Tab.Color = RGB(255, 0, 0)
Else
If Target.Value = "Cloturé" Then
ActiveSheet.Tab.Color = RGB(39, 82, 18)
End If
End If
End If
End If
End Sub
et dans l'etat actuel ça marche pas en mettent les 2 parties de la macro
je m'apperçois aussi que j'avais mis des validations de donées dans la cellule C8 il faudrait l'enlever pour le test merci