A
aure
Guest
Bonjour,
J'ai un problème avec l'exécution de ma macro.
Je voudrais qu'elle s'exécute dès qu'une des cellules (C55:G59) changent de valeur.
Leur valeur sont récupérées dans une autre feuille.
Voici le code que j'ai fait :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim j As Integer
For i = 3 To 7
For j = 46 To 50
If Cells(j, i).Value = 1 Then
Cells(j, i).Interior.ColorIndex = 27
Cells(j, i).Font.ColorIndex = 27
ElseIf Cells(j, i).Value = 2 Then
Cells(j, i).Interior.ColorIndex = 3
Cells(j, i).Font.ColorIndex = 3
ElseIf Cells(j, i).Value = 3 Then
Cells(j, i).Interior.ColorIndex = 4
Cells(j, i).Font.ColorIndex = 4
ElseIf Cells(j, i).Value = 4 Then
Cells(j, i).Interior.ColorIndex = 10
Cells(j, i).Font.ColorIndex = 10
ElseIf Cells(j, i).Value = 5 Then
Cells(j, i).Interior.ColorIndex = 2
Cells(j, i).Font.ColorIndex = 2
Else
Cells(j, i).Interior.ColorIndex = 2
Cells(j, i).Font.ColorIndex = 1
End If
Next
Next
End Sub
Merci par avance pour votre aide.
J'ai un problème avec l'exécution de ma macro.
Je voudrais qu'elle s'exécute dès qu'une des cellules (C55:G59) changent de valeur.
Leur valeur sont récupérées dans une autre feuille.
Voici le code que j'ai fait :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim j As Integer
For i = 3 To 7
For j = 46 To 50
If Cells(j, i).Value = 1 Then
Cells(j, i).Interior.ColorIndex = 27
Cells(j, i).Font.ColorIndex = 27
ElseIf Cells(j, i).Value = 2 Then
Cells(j, i).Interior.ColorIndex = 3
Cells(j, i).Font.ColorIndex = 3
ElseIf Cells(j, i).Value = 3 Then
Cells(j, i).Interior.ColorIndex = 4
Cells(j, i).Font.ColorIndex = 4
ElseIf Cells(j, i).Value = 4 Then
Cells(j, i).Interior.ColorIndex = 10
Cells(j, i).Font.ColorIndex = 10
ElseIf Cells(j, i).Value = 5 Then
Cells(j, i).Interior.ColorIndex = 2
Cells(j, i).Font.ColorIndex = 2
Else
Cells(j, i).Interior.ColorIndex = 2
Cells(j, i).Font.ColorIndex = 1
End If
Next
Next
End Sub
Merci par avance pour votre aide.