ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Display cells when box is checked (https://www.excelbanter.com/excel-discussion-misc-queries/57261-display-cells-when-box-checked.html)

Mon

Display cells when box is checked
 
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!

Dave Peterson

Display cells when box is checked
 
maybe

myRng.Hidden = not Me.CheckBox1.Value


Mon wrote:

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!


--

Dave Peterson

Mon

Display cells when box is checked
 
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!

"Dave Peterson" wrote:

maybe

myRng.Hidden = not Me.CheckBox1.Value


Mon wrote:

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!


--

Dave Peterson


Dave Peterson

Display cells when box is checked
 
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.

Mon wrote:

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!

"Dave Peterson" wrote:

maybe

myRng.Hidden = not Me.CheckBox1.Value


Mon wrote:

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!


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com