Change radio button when sheet is protected

  • Thread starter Thread starter plantechbl
  • Start date Start date
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
 
DUHHHH!

Debra, Thank you very much! I had tried a lot of much more complex
solutions and missed the most straightforward. I have gotten a lot of
good info from your website.

Thanks again,
Bill
 
You're welcome! Thanks for letting me know that it helped, and I'm glad
you like the info on my site.

DUHHHH!

Debra, Thank you very much! I had tried a lot of much more complex
solutions and missed the most straightforward. I have gotten a lot of
good info from your website.

Thanks again,
Bill
 
Back
Top