Yldie
XLDnaute Junior
Cher(e)s internautes,
J'ai un message d'erreur "incompatibilité de type" qui ne bloque pas ma macro mais qui par contre ôte ma protection (et là ça me gêne un peu plus !!!), merci de bien vouloir m'aider
....................voici cette macro
Sub macro()
Dim Cellule As Range
ActiveSheet.Unprotect ("toto")
Application.ScreenUpdating = False
For Each Cellule In Range("B5:F139")
Select Case Cellule.Value
Case Is = ""
Cellule.Interior.ColorIndex = 0
Case Is = 0
Cellule.Interior.ColorIndex = 0
Cellule.Font.ColorIndex = 2
Case Is = "WE"
Cellule.Interior.ColorIndex = 48
Cellule.Font.ColorIndex = 2
Case Is = "piscine"
Cellule.Interior.ColorIndex = 34
Case Is = "muscu"
Cellule.Interior.ColorIndex = 40
Case Is = "R"
Cellule.Interior.ColorIndex = 41
Cellule.Font.ColorIndex = 2
Case Is = "sport"
Cellule.Interior.ColorIndex = 4
Case Is = "balade"
Cellule.Interior.ColorIndex = 38
Case Is = "P"
Cellule.Interior.ColorIndex = 44
Cellule.Font.ColorIndex = 1
Case Is = "vacances"
Cellule.Interior.ColorIndex = 39
Cellule.Font.ColorIndex = 2
End Select
Next Cellule
Range("a1").Select
Application.ScreenUpdating = True
ActiveSheet.Protect ("toto")
End Sub
Bonne soirée
J'ai un message d'erreur "incompatibilité de type" qui ne bloque pas ma macro mais qui par contre ôte ma protection (et là ça me gêne un peu plus !!!), merci de bien vouloir m'aider
....................voici cette macro
Sub macro()
Dim Cellule As Range
ActiveSheet.Unprotect ("toto")
Application.ScreenUpdating = False
For Each Cellule In Range("B5:F139")
Select Case Cellule.Value
Case Is = ""
Cellule.Interior.ColorIndex = 0
Case Is = 0
Cellule.Interior.ColorIndex = 0
Cellule.Font.ColorIndex = 2
Case Is = "WE"
Cellule.Interior.ColorIndex = 48
Cellule.Font.ColorIndex = 2
Case Is = "piscine"
Cellule.Interior.ColorIndex = 34
Case Is = "muscu"
Cellule.Interior.ColorIndex = 40
Case Is = "R"
Cellule.Interior.ColorIndex = 41
Cellule.Font.ColorIndex = 2
Case Is = "sport"
Cellule.Interior.ColorIndex = 4
Case Is = "balade"
Cellule.Interior.ColorIndex = 38
Case Is = "P"
Cellule.Interior.ColorIndex = 44
Cellule.Font.ColorIndex = 1
Case Is = "vacances"
Cellule.Interior.ColorIndex = 39
Cellule.Font.ColorIndex = 2
End Select
Next Cellule
Range("a1").Select
Application.ScreenUpdating = True
ActiveSheet.Protect ("toto")
End Sub
Bonne soirée