I have an Excel (2007) file that has a macro to hide/unhide rows based on a click event in a check box.

When I protect the sheet, the macro does not work.

I am using the following code:

Private Sub CheckBox8_Click()
If CheckBox8.Value = False Then
Rows("29:32").Hidden = True
Else
Rows("29:32").Hidden = False
End If
End Sub

Is there a way I can protect the sheet and allow the macro to work?