CheckBox Code Error

ankethaton

New Member
Joined
Dec 28, 2005
Messages
5
Hi There,

I need a checkbox which when ticked, makes a worksheet visible and when nt, hides the worksheet.

This is my code but it does not seem to work.

Private Sub Checkbox1_Click()
If CheckBox1.Value = True Then
Sheets("Corporate").Visible = True
Else If
CheckBox1.Value = False Then
Sheets("Corporate").Visible = False
End If
End Sub

Thanks for any inputs on this
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

ankethaton

New Member
Joined
Dec 28, 2005
Messages
5
Thanks a lot. It is working now. Hope you can help me with one more thing:

In the same code I need to add a line to hide a row in a different worksheet

I have this:

Worksheet("Total Demand").Range("A7").EntireRow.Visible = True

What it needs to do is make this row visible in a different worksheet.

Thanks a lot if you can help me out. Let's say I'm a newbe to all this VBA.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,285
Messages
5,571,310
Members
412,381
Latest member
RogerL
Top