boujour
pouvez vous m'aider a corriger la macro ci-jointe pour enveler la protection
automatique
merci d'avance
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
Dim c As Range
If Not Intersect(Target, Range("B:AF")) Is Nothing Then
For Each c In Target
With c.Interior
If c.Text = "C" Or c.Text = "C/" Or c.Text = "/C" Or c.Text = "HS" Or c.Text = "HS/" Or c.Text = "/HS" Or c.Text = "AS" Or c.Text = "/AS" Or c.Text = "AS/" Or c.Text = "F" Or c.Text = "/F" Or c.Text = "F/" Or c.Text = "CE" Or c.Text = "/CE" Or c.Text = "CE/" Then
.ColorIndex = 40
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 3
.Pattern = xlSolid
End If
If c.Text = "M" Then
.ColorIndex = 22
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 2
.Pattern = xlSolid
End If
If c.Text = "AT" Then
.ColorIndex = 43
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 2
.Pattern = xlSolid
End If
ActiveSheet.Protect
End With
Next
End If
End Sub
pouvez vous m'aider a corriger la macro ci-jointe pour enveler la protection
automatique
merci d'avance
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
Dim c As Range
If Not Intersect(Target, Range("B:AF")) Is Nothing Then
For Each c In Target
With c.Interior
If c.Text = "C" Or c.Text = "C/" Or c.Text = "/C" Or c.Text = "HS" Or c.Text = "HS/" Or c.Text = "/HS" Or c.Text = "AS" Or c.Text = "/AS" Or c.Text = "AS/" Or c.Text = "F" Or c.Text = "/F" Or c.Text = "F/" Or c.Text = "CE" Or c.Text = "/CE" Or c.Text = "CE/" Then
.ColorIndex = 40
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 3
.Pattern = xlSolid
End If
If c.Text = "M" Then
.ColorIndex = 22
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 2
.Pattern = xlSolid
End If
If c.Text = "AT" Then
.ColorIndex = 43
.Pattern = xlSolid
ElseIf c.Text = "" Then
.ColorIndex = 2
.Pattern = xlSolid
End If
ActiveSheet.Protect
End With
Next
End If
End Sub