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:

Kinchen

New Member
Joined
Aug 22, 2011
Messages
14
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 :)
 

Forum statistics

Threads
1,082,323
Messages
5,364,586
Members
400,808
Latest member
formulasataglance

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top