Change radio button when sheet is protected

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
 
P

plantechbl

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
 
D

Debra Dalgleish

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top