Checkbox Loop Help

Kinchen

New Member
Joined
Aug 22, 2011
Messages
14
Hello,

I've been trying to figure out how to loop check boxes to unhide rows in a separate sheet. What i've tried so far from going through the various forums in this site:

Dim x As Integer
For x = 2 To 79

Private Sub checkbox1_click()
Call HideUnhide
End Sub

Private Sub checkbox(1+x)_click()
Call HideUnhide
End Sub

Private Sub HideUnhide()
If CheckBox1.Value = True Then
Sheets(Report).Row(1, 35).Hidden = False
Else
Sheets(Report).Row(1, 35).Hidden = True
End If

If Checkbox(1 + x).Value = True Then
Sheets(Report).Row((((1 - x) * 35)-1), 35 * x).Hidden = False
Else
Sheets(Report).Row((((1 - x) * 35)-1), 35 * x).Hidden = True
End If
End Sub

So basically what i'm trying to do is I have a layout of a storage yard that has 79 units with checkboxes beside them (in various columns/rows in the "layout" tab) and I want to be able to unhide rows in the "Report" tab if the checkbox value = true. The report table goes from 1-2765 in 35 cell increments. (ie. 1-35, 36-70, etc.)
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
In Case anyone comes across a similar problem; I've found a way to make it work, but it is very tedious.
Sub Button80_Click()

If Sheets("Layout").CheckBox1.Value = True Then
Sheets("Reports").Select
[1:35].EntireRow.Hidden = False
Else:
Sheets("Reports").Select
[1:35].EntireRow.Hidden = True
End If

If Sheets("Layout").CheckBox2.Value = True Then
Sheets("Reports").Select
[36:70].EntireRow.Hidden = False
Else:
Sheets("Reports").Select
[36:70].EntireRow.Hidden = True
End If
' I did this for 75 Buttons which is not very efficient time wise, but it does work
End Sub

If anyone figures out how to use a formula please post it below for future reference :)
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top