Hide/Unhide Rows with a Checkbox

webdoc

New Member
Joined
Oct 8, 2002
Messages
18
Can someone tell me how to unhide rows when a checkbox is checked and then hide the same rows when it is unchecked? I'm new to Excel programming, so feel free to give lots of detail if you like. Thanks!!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Good morning,

I need help adding in additional code to a checkbox that hides rows on the same sheet as the checkbox. I need to add code that also hides and unhides cells on a different sheet. Below is the code I'm using. If the check box is marked, it needs to unhide row 6 on sheet "Service Plan". If unchecked, it hides row 6.

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
[42:90,111:116].EntireRow.Hidden = False
Else: [42:90,111:116].EntireRow.Hidden = True
End If
End Sub
 
Upvote 0
Looking for an issue to the following:

I have a checkbox that I need to display the rest of the sheet (rows 4:69) when checked. It works, but it's saying that there is an issue with the "Else: [4:69]" line and I'm receiving the runtime error 1004.

I also need to protect the worksheet and it appears that also locks the checkbox.

Code:
Private Sub CheckBox1_Click()


If CheckBox1 = True Then


    [4:69].EntireRow.Hidden = False


    Else: [4:69].EntireRow.Hidden = True


End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top