ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple CHeck box to view/hide rows (https://www.excelbanter.com/excel-programming/386297-simple-check-box-view-hide-rows.html)

Shelly

Simple CHeck box to view/hide rows
 
I'm trying to create checkbox where if it's checked rows 6-9 show, if it's
unchecked they are hidden. I've go the follow, but I must be missing
something...

--------------------------


Private Sub Risk_Box()
Application.ScreenUpdating = False
If Risk_Box.Value = 0 Then
Range("A6:A9").EntireRow.Hidden = True
Else
If Risk_Box.Value < 0 Then
Range("A6:A9").EntireRow.Hidden = False
End If
End If
Application.ScreenUpdating = True
End Sub

---------------------------

Thanks for the help.

Ron de Bruin

Simple CHeck box to view/hide rows
 
Hi Shelly

If you use a checkbox from the controltoolbox then try this for a checkbox named "CheckBox1"
This is event code for thr sheetmodule

Private Sub CheckBox1_Click()
If CheckBox1.Value = False Then
Range("A6:A9").EntireRow.Hidden = True
Else
Range("A6:A9").EntireRow.Hidden = False
End If
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Shelly" wrote in message ...
I'm trying to create checkbox where if it's checked rows 6-9 show, if it's
unchecked they are hidden. I've go the follow, but I must be missing
something...

--------------------------


Private Sub Risk_Box()
Application.ScreenUpdating = False
If Risk_Box.Value = 0 Then
Range("A6:A9").EntireRow.Hidden = True
Else
If Risk_Box.Value < 0 Then
Range("A6:A9").EntireRow.Hidden = False
End If
End If
Application.ScreenUpdating = True
End Sub

---------------------------

Thanks for the help.



All times are GMT +1. The time now is 02:18 PM.

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