Run-Time Error 1004/ unable to set the hidden property of the rang

S

Sean

I have a spreadsheet that has the same survey details on repeated down the
page.
There is a radio button 1-13 and by clicking in one of them you get the
corresponding number of survey sections. I want most of the page protected,
to stop people tinkering with it but when it is locked I get the Run-Time
error 1004 when selecting one of the radio buttons

copy of VB below

Can anyone help

If I put the Me.Unprotect at the start and Me.Prptect at end it works but
ask for password to be entered which defeats the object.

Private Sub OptionButton_1_Click()

If Me.OptionButton_1.Value = -1 Then
Rows("37:470").Hidden = True


End If

End Sub

Private Sub OptionButton_10_Click()

If Me.OptionButton_10.Value = -1 Then
Rows("37:360").Hidden = False
Rows("362:470").Hidden = True

End If

End Sub

Private Sub OptionButton_11_Click()

If Me.OptionButton_11.Value = -1 Then
Rows("37:397").Hidden = False
Rows("398:470").Hidden = True

End If

End Sub
Private Sub OptionButton_12_Click()

If Me.OptionButton_12.Value = -1 Then
Rows("37:433").Hidden = False
Rows("434:470").Hidden = True

End If

End Sub
Private Sub OptionButton_13_Click()

If Me.OptionButton_13.Value = -1 Then
Rows("37:470").Hidden = False
End If

End Sub

Private Sub OptionButton_2_Click()

If Me.OptionButton_2.Value = -1 Then
Rows("37:73").Hidden = False
Rows("74:470").Hidden = True
End If

End Sub

Private Sub OptionButton_3_Click()

If Me.OptionButton_3.Value = -1 Then
Rows("37:109").Hidden = False
Rows("110:470").Hidden = True
End If

End Sub

Private Sub OptionButton_4_Click()

If Me.OptionButton_4.Value = -1 Then
Rows("37:145").Hidden = False
Rows("146:470").Hidden = True
End If

End Sub

Private Sub OptionButton_5_Click()

If Me.OptionButton_5.Value = -1 Then
Rows("37:181").Hidden = False
Rows("182:470").Hidden = True
End If

End Sub

Private Sub OptionButton_6_Click()

If Me.OptionButton_6.Value = -1 Then
Rows("37:217").Hidden = False
Rows("218:470").Hidden = True
End If

End Sub

Private Sub OptionButton_7_Click()

If Me.OptionButton_7.Value = -1 Then
Rows("37:253").Hidden = False
Rows("254:470").Hidden = True
End If

End Sub

Private Sub OptionButton_8_Click()

If Me.OptionButton_8.Value = -1 Then
Rows("37:289").Hidden = False
Rows("290:470").Hidden = True
End If

End Sub

Private Sub OptionButton_9_Click()

If Me.OptionButton_9.Value = -1 Then
Rows("37:325").Hidden = False
Rows("326:470").Hidden = True
End If

End Sub
 
J

John Bundy

It asks for the password because you don't provide one, you can do this
easily with
activesheet.Unprotect Password:="yourPassword"
then
activesheet.Protect Password:="yourPassword"
 

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

Top