P
plantechbl
I have two radio (option) buttons (from the forms menu, not controls),
one to protect the sheet and one to unprotect the sheet. These are
linked to cell $D$1 I also have code that protects/unprotects the
sheet in order to sort the data.
How can I get the radio buttons to change to reflect the current status
of the worksheet (protected/unprotected) when the code runs to sort the
sheet.
My code:
Sub SortRoom()
Call UnProtSheet
Application.Goto Reference:="DataEntry"
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending,
Key2:=Range("C4") _
, Order2:=xlAscending, Key3:=Range("D4"), Order3:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
DataOption3:= _
xlSortNormal
Range("D3").Select
Call ProtSheet
End Sub
Sub UnProtSheet()
Application.CutCopyMode = False
Sheets("Parts_TakeOff").Unprotect
End Sub
Sub ProtSheet()
Application.CutCopyMode = False
Sheets("Parts_TakeOff").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Sheets("Parts_TakeOff").EnableSelection = xlUnlockedCells
End Sub
Thanks in advance,
Bill
one to protect the sheet and one to unprotect the sheet. These are
linked to cell $D$1 I also have code that protects/unprotects the
sheet in order to sort the data.
How can I get the radio buttons to change to reflect the current status
of the worksheet (protected/unprotected) when the code runs to sort the
sheet.
My code:
Sub SortRoom()
Call UnProtSheet
Application.Goto Reference:="DataEntry"
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending,
Key2:=Range("C4") _
, Order2:=xlAscending, Key3:=Range("D4"), Order3:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
DataOption3:= _
xlSortNormal
Range("D3").Select
Call ProtSheet
End Sub
Sub UnProtSheet()
Application.CutCopyMode = False
Sheets("Parts_TakeOff").Unprotect
End Sub
Sub ProtSheet()
Application.CutCopyMode = False
Sheets("Parts_TakeOff").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Sheets("Parts_TakeOff").EnableSelection = xlUnlockedCells
End Sub
Thanks in advance,
Bill