View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
5elpep 5elpep is offline
external usenet poster
 
Posts: 8
Default Mutually Exclusive Option Boxes

Cheers Dave & Fred,

I am now trying to control protection on part of the worksheet via one
of my option buttons.
Basically when the option is checked the cells should be unprotected
and when I select one of the other option buttons in the group the
cells should be protected again.

I am using the below code but it oesn't seem to work. It unprotects
and protects the sheet fine but it won't format the cells as
required. Any pointers would be much appreciated.

Private Sub OptionButton1_Click()

If OptionButton1.Value = True Then

ActiveSheet.Unprotect
Range("I22:K35").Select
Selection.Locked = False
Selection.FormulaHidden = False
Selection.Interior.ColorIndex = 39
ActiveSheet.Protect

Else

ActiveSheet.Unprotect
Range("I22:K35").Select
Selection.Locked = True
Selection.FormulaHidden = True
Selection.Interior.ColorIndex = xlNone
ActiveSheet.Protect

End If
End Sub