I need help with macros and check boxes.

M

Marc

I can record a macro to hide or unhide columns or cells but I need to
reverse the process when the button toggles to the other position. I need
the cells to be hidden until the box is "checked" but hide if it gets
unchecked.

Marc
 
G

Guest

Hi Marc,

Try this:

Placed a check box on excel and paste this code below:

Private Sub CheckBox1_Click()
Range("A1").Select 'Active Cell Select
If CheckBox1.Value = True Then
Selection.EntireRow.Hidden = True
Else: CheckBox1.Value = False
Selection.EntireRow.Hidden = False
End If
End Sub

Hope this helps.
 
M

Marc

Mel thanks! It dawned on me after I sent the post if I used the check boxes
from the "Forms" not the "Control Toolbox" I could get a true false and use
that to make the changes but yours is more elegant.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top