Modifier un petit code en Macro
Bonsoir a toutes et tous, Forum bonsoir
j'aurai besoin svp de transformer le code ci-dessous qui fonctionne très bien en Macro Sub baptiser par Ex: (ActiveRepere) que je puisse appeller ou exécuter quand j'ai besoin.
j'ai essayer mais ca marche pas :cry:
Merci a vous pour votre temps et votre savoir partagé.
La bonne soirée a vous
Cordialement Ray
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Public Sub Worksheet_Calculate()
C = Month(Now) + 4
R = [Z1].Value: If R < 2 Then R = 1
Cells(R, 17).Font.ColorIndex = 10 'Vert foncé
Cells(R, 17).Interior.ColorIndex = 15
With Cells(R, 17).Interior
.ColorIndex = 15 'Gris affiche la barre repère Gris clair
If Cells(20, C).Text <> Cells(R, 17).Text Then
Application.EnableEvents = False
R = R + 1: If R > 26 Then R = 2
[Z1].Value = R
Cells(R, 17).Value = Cells(20, C).Value
.ColorIndex = xlNone
Application.EnableEvents = True
End If
End With
Cells(R, 17).Font.ColorIndex = 5 'Bleu
End Sub |