Display cells when box is checked

M

Mon

I tried VBA code that was posted earlier...
the code is:

Private Sub CheckBox1_Click()
Dim myRng as Range
Set myRng = Me.Range("A20:A29").EntireRow (obviously suited to my range)
myRng.Hidden = Me.CheckBox1.Value
End Sub

What this does is make it so that the rows are showing when the checkbox is
NOT checked and once the checkbox IS checked, the rows are HIDDEN. How do I
make it the other way around? I want to Check the box and have what was
hidden now be visible.
Obviously I'm new at the codes, etc.
thanks!
 
D

Dave Peterson

maybe

myRng.Hidden = not Me.CheckBox1.Value

I tried VBA code that was posted earlier...
the code is:

Private Sub CheckBox1_Click()
Dim myRng as Range
Set myRng = Me.Range("A20:A29").EntireRow (obviously suited to my range)
myRng.Hidden = Me.CheckBox1.Value
End Sub

What this does is make it so that the rows are showing when the checkbox is
NOT checked and once the checkbox IS checked, the rows are HIDDEN. How do I
make it the other way around? I want to Check the box and have what was
hidden now be visible.
Obviously I'm new at the codes, etc.
thanks!
 
M

Mon

GREAT - it worked! Thank you!!
Now, is it possible to change the font size or make the Title to the Check
Box Bold??
I need to show that it's a pretty big or important option in the form...

thanks!
 
D

Dave Peterson

Maybe...

Option Explicit
Private Sub CheckBox1_Click()
Dim myRng As Range
Set myRng = Me.Range("A20:A29").EntireRow
myRng.Hidden = Not Me.CheckBox1.Value
Me.CheckBox1.Font.Bold = Me.CheckBox1.Value
End Sub

Add the "NOT" if you want--not sure when it should be bold.

If you always want it bold, then show its properties and doubleclick on Font.
You can change the font and boldness there.
 
Top