Excel macro - show & hide row and checkboxes? I need a row [with a "control" check box] to be hidden/unhidden when the check box above it is ticked/unticked. The cells that i want hidden are B16:D16 and the check box is in cell C16, they are both "control" check boxes. The check boxes also need to be linked to two different cells.

By: Guest
Date: Unknown--

Answer 1


Right-click on Checkbox1 (fitting) and select view code. Paste this code in the VB edit window.


Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then

Rows(16).Hidden = False

CheckBox2.Visible = True


Rows(16).Hidden = True

CheckBox2.Visible = False

End If

End Sub


This assumes the names of the two control check boxes are CheckBox1 and CheckBox2


You can't hide part of a row. You can only hide whole rows or columns. So in your case, you would have to hide all of row 16.

If you want to hide just the values in B16:D16 (the cells will still be there), you could do it in a couple of ways.

1.) Make the font color and background color the same color e.g. white

2. copy the values to some obscure cells somewhere and delete the values in B16:D16. Then later copy the values back when you want them visible.

Give more details on exactly what you want to do and I'll see if I can make a macro for you.

[d] By: Guest
Date: Unknown---
What is 1 + 100

Just Updated::