I am so confused! I need help with a check box and a macro.

M

Marc

I am trying to have a check box control whether certain columns, rows and
worksheets are hidden or unhidden. Over at the newusers forum someone gave
me a macro that I have tried to modify to make this happen.

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

The range should be the columns, rows and worksheets that are to be hidden
or unhidden?
The Select.Entire Row is what the macro acts on?
If I've renamed my check boxes than I should use that name in place on
CheckBox1?

Any help would be appreciate.

Marc
 
Y

Yngve

hi
this will hide row 1

Private Sub CheckBox1_Click()
Columns("A:A").Select
Range("A1").Activate 'Active Cell Select
If CheckBox1.Value = True Then

Range("A1").EntireRow.Hidden = True
Else: CheckBox1.Value = False
Range("A1").EntireRow.Hidden = False
End If
End Sub



Regards Yngve
 

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