Option Explicit
Private Sub Worksheet_Activate()
Dim L As Long, I As Long
Me.Protect DrawingObjects:=False, Contents:=True, Scenarios:=False, UserInterfaceOnly:=True, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, AllowDeletingRows:=True, _
AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
Me.EnableSelection = xlUnlockedCells
For L = 3 To 10
For I = 0 To 3
Verrou Me.Cells(L, Array("C", "T", "V", "W")(I)), _
Me.Cells(L, Array("T", "C", "W", "V")(I))
Next I
Next L
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim I As Long, LAutre As Range
If Target.Count <> 1 Then Exit Sub
If Intersect(Me.[3:10], Target) Is Nothing Then Exit Sub
For I = 0 To 3
If Not Intersect(Me.Columns(Array("C", "T", "V", "W")(I)), Target) Is Nothing Then
Set LAutre = Intersect(Me.Columns(Array("T", "C", "W", "V")(I)), Target.EntireRow)
Verrou Target, LAutre: Verrou LAutre, Target
Exit Sub: End If
Next I
End Sub
Private Sub Verrou(ByVal Cellule As Range, ByVal LAutre As Range)
If IsEmpty(LAutre.Value) Then
Cellule.Interior.Color = &H80FFFF
Cellule.Locked = False
ElseIf IsEmpty(Cellule.Value) Then
Cellule.Interior.Color = &HC0C0C0
Cellule.Locked = True
Else
Cellule.Interior.Color = &H4040FF
Cellule.Locked = False
End If
End Sub