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
Debra Dalgleish - 14 Jan 2007 16:42 GMT
You could set the value of cell D1 after the sort:
Range("D1").Value = 1
> 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
[quoted text clipped - 36 lines]
> Thanks in advance,
> Bill

Signature
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html
plantechbl@earthlink.net - 15 Jan 2007 20:33 GMT
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 could set the value of cell D1 after the sort:
>
[quoted text clipped - 45 lines]
> Contextures
> http://www.contextures.com/tiptech.html
Debra Dalgleish - 15 Jan 2007 21:30 GMT
You're welcome! Thanks for letting me know that it helped, and I'm glad
you like the info on my site.
> DUHHHH!
>
[quoted text clipped - 54 lines]
>>Contextures
>>http://www.contextures.com/tiptech.html

Signature
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html