Hi Bob
Thanks for your help. I corrected missing quotes, but I am still getting an
error:
"Run time error 1004: Unable to set the Locked property of the Range class"
I am using data validation to limit the number of characters in the cells.
I have tried to recreate the error in a separate spreadsheet with just the 3
buttons and 3 cells, with data validation and it works fine, but I
consistently get the error in my form. I have check the help and none of it
seems to apply. Any suggestions?
"Bob Phillips" wrote:
This works for me. You were close
Private Sub OptionButton1_Click()
Worksheets("PART A").Unprotect
Worksheets("PART A").Range("I11").Locked = False
Worksheets("PART A").Range("I13:I15,D23:D24").Locked = True
Worksheets("PART A").Protect
End Sub
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"smcs" wrote in message
...
I have little knowledge of how to write VB code.
I have a form with 3 option buttons alongside 3 cells for data entry.
When
a button is selected I want the corresponding cell to allow data entry and
the other 2 to be locked. Why does this code not work:
Private Sub OptionButton1_Click()
Worksheets("PART A").Unprotect
Worksheets("PART A").Range(i11).Locked = False
Worksheets("PART A").Range("i13:i15,d23:d24").Locked = True
Worksheets("PART A").Protect
End Sub