Checkbox to Unhide Rows

  • Thread starter Thread starter WOLLAM
  • Start date Start date
W

WOLLAM

Is it possible to use a check box to 'Unhide Rows'? What I would like to do
is have a client select a check box(es), then press a button I have inserted
into the spreadsheet to run a macros. This macros would Unhide rows
according to which boxes have been checked. Or is there a way to have rows
'reveal' or hide themselves as a check box is checked or unchecked, thus
avoiding the need for a macros? My macros skills are OK at best. Thank you
in advance for any and all help.

Dan
 
Hi Dan

No extra buttons needed, we tie the macro up to the check box.

As this is an event code it shall be in the codesheet for the sheet where
the checkbox is.
With a Check box named CheckBox1 this macro will unhide rows 1:3 when the
check box is checked. When the check box is unchecked rows 1:3 will be
hidden.

Private Sub CheckBox1_Change()
If Me.CheckBox1.Value = True Then
Rows("1:3").Hidden = False
Else
Rows("1:3").Hidden = True
End If
End Sub

Regards,
Per
 
Hi Per,

Thanks for the input. However, I don't really know what the codesheet is or
how to enter/add anything to it. Any tips?

Thanks,
Dan
 
Show the control toolbox toolbar (via View|Toolbars in xl2003 menus)--not the
Forms toolbar!

Click on the design mode icon.
Add a checkbox to a nice location.
Double click on that checkbox and you'll be taken to the VBE--where that code is
going to go.

You see something like this on the righthand side:

Private Sub CheckBox1_Click()

End Sub

Delete that and replace it with Wollam's code:

Then back to excel.
Click the design mode icon again (to get back to normal)
and test it out.

I wouldn't put the checkbox in a row that's going to be hidden!

Ps. Make sure the Checkbox1 stuff matches the name of the checkbox you added.
It could be different if you've played around with it.

Then
 
Back
Top