bonsoir a vous, voila j'ai adapté un morceau de code VBA pour le besoin de mon fichier, mais j'aimerais bien proteger ma feuille contre les modifications de cellules. J'ai essayer "Sheets Protect" mais j'ai un bug.
Si quelqu'un pourrait me venir en aide.
Avec mes remerciements
hervé
ci dessous le code VBA
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Plage As Variant
Dim L As Byte, I As Long
Dim C As Byte
If Target.Address(0, 0) = "A2" Then
Me.Range("A30:Y1000").ClearContents
L = 30
With Sheets("BaseDonnées")
Plage = .Range("A2:AK" & .Range("A65536").End(xlUp).Row)
End With
For I = 1 To UBound(Plage)
If Target.Value = Plage(I, 1) Then
For C = 1 To 37
Me.Cells(L, C) = Plage(I, C)
Next C
L = L + 1
End If
Next
Else
End If
End Sub