Sub showParameter()
If ThisWorkbook.Sheets(2).Range("J1") = 1 Then
With ThisWorkbook.Worksheets(1)
.Protect Password:="123india", UserInterfaceonly:=True, DrawingObjects:=False, Contents:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFormattingColumns:=True
.Cells.Locked = False
.Range("A1:E50").Locked = True
.EnableSelection = xlNoRestrictions
.EnableOutlining = True
End With
ElseIf ThisWorkbook.Sheets(2).Range("J1") = 2 Then
With ThisWorkbook.Worksheets(1)
.Protect Password:="123india", UserInterfaceonly:=True, DrawingObjects:=False, Contents:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFormattingColumns:=True
.Cells.Locked = False
.Range("A1:E50").Locked = True
.EnableSelection = xlNoRestrictions
.EnableOutlining = True
End With
End If
End Sub
If ThisWorkbook.Sheets(2).Range("J1") = 1 Then
With ThisWorkbook.Worksheets(1)
.Protect Password:="123india", UserInterfaceonly:=True, DrawingObjects:=False, Contents:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFormattingColumns:=True
.Cells.Locked = False
.Range("A1:E50").Locked = True
.EnableSelection = xlNoRestrictions
.EnableOutlining = True
End With
ElseIf ThisWorkbook.Sheets(2).Range("J1") = 2 Then
With ThisWorkbook.Worksheets(1)
.Protect Password:="123india", UserInterfaceonly:=True, DrawingObjects:=False, Contents:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, AllowFormattingColumns:=True
.Cells.Locked = False
.Range("A1:E50").Locked = True
.EnableSelection = xlNoRestrictions
.EnableOutlining = True
End With
End If
End Sub
No comments:
Post a Comment