E
exceldu13
Guest
bonjour,
pouvez vous m'aider à simplifier ce code qui me parâit pas très finaud... :?
sur ma feuille je veux dévérouiller certaines cellules sur les 2 premières lignes suivantes quand on change la valeur de l'activecell.
merci bon we🙂
pouvez vous m'aider à simplifier ce code qui me parâit pas très finaud... :?
sur ma feuille je veux dévérouiller certaines cellules sur les 2 premières lignes suivantes quand on change la valeur de l'activecell.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
LOCKE_CELLS
End Sub
Sub LOCKE_CELLS()
ActiveSheet.Unprotect "mon_code_secret^^"
Dim c As Integer
c = ActiveCell.Row
If Range("a" & c) <> "" Or Range("b" & c) <> "" Or Range("c" & c) <> "" Then
Range("a" & c + 1, "a" & c + 2).Locked = False
Range("b" & c + 1, "b" & c + 2).Locked = False
Range("c" & c + 1, "c" & c + 2).Locked = False
Range("d" & c + 1, "d" & c + 2).Locked = False
Range("e" & c + 1, "e" & c + 2).Locked = False
Range("l" & c + 1, "l" & c + 2).Locked = False
ActiveSheet.Protect "mon_code_secret^^"
End If
End Sub
merci bon we🙂
Dernière modification par un modérateur: