Multiple checkboxes & hide unhide rows

janomm

New Member
Joined
Jun 22, 2012
Messages
2
Hello,
I've looked a lot in the different threads related to checkboxes or unhide row but didn't found an answer that allowed me to do what I need to.

My question is how to proceed in VBA to structure the following events:
Row 1 is visible. In R1C1 is a checkboxA. Clicking checkboxA unhide row 2. In R2C1 is a checkboxB. Clicking checkboxB unhide row 3.

Row 4 is visible. In R4C1 is a checkbox C. Clicking checkboxC unhide row 5. In R5C1 is a checkboxD. Clicking checkboxD unhide row 6.

Row 7 is visible. In R7C1 is a checkb...

Unclicking the checkboxes hides the corresponding row triggered by the corresponding checkbox. This is above my league and that's why I need help.

With a demanding boss who is regularly breathing in my neck...
Tnx in advance
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Not knowing what version of excel you're using, or where these checkboxes came from (I'm assuming they're activeX checkboxes - from the Controls Toolbox toolbar),
here's something you can try:
Code:
Private Sub CheckBoxA_Click()
Rows(2).EntireRow.Hidden = Not CheckBoxA
End Sub

Private Sub CheckBoxB_Click()
Rows(3).EntireRow.Hidden = Not CheckBoxB
End Sub
and so on...

Does that help?
 
Upvote 0
HalfAce: EntireRow is not needed ;-)
 
Upvote 0

Forum statistics

Threads
1,226,246
Messages
6,189,858
Members
453,575
Latest member
Taljanin

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