Const MDP = "test2"
Sub Define_Lock()
' ------------------------------------------------------
' A ne faire initialement qu'une fois (normalement) :
' Verrouiller toutes les cellules
' sauf celles qui sont dans la plage indiquée
' ------------------------------------------------------
Dim L As Long
With Worksheets("Immo")
.Cells.Locked = True
L = .Cells(Rows.Count, "H").End(xlUp).Row
Union(.Range("B6:J" & L), .Range("L6:L" & L)).Locked = False
End With
End Sub
Sub Masquer()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With Worksheets("Immo")
.Activate
.[X:DO].EntireColumn.Hidden = True
.EnableOutlining = True
.EnableSelection = xlUnlockedCells
.Protect _
Password:=MDP, _
UserInterfaceOnly:=True, _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True
End With
Application.Calculation = xlCalculationAutomatic
End Sub
Sub Afficher()
With Worksheets("Immo")
.Unprotect MDP
.[X:DO].EntireColumn.Hidden = False
End With
End Sub