Dears,
trying to achieve the following:
I have a toggle button that decides whether the condition in column c or in column g should be used, and resets the sheet to fully visible when switched.
I have 12 checkboxes that can be checked / unchecked and only the rows required are visible.
I have the following code per checkbox, which works fine if only that one Checbox is checked. Question is now how to code it when i check 2 or more Checkboxes and want to have the rows visible from all the checked checkboxes.
Private Sub CheckBox1_Click()
CheckBox1.Caption = "APR"
If CheckBox1 = True And ToggleButton1.Value = True Then
For Each cell In ActiveSheet.Range("G10:G250")
If Not cell.Value = "APR" Then
cell.EntireRow.Hidden = True
End If
Next cell
ElseIf CheckBox1 = True And ToggleButton1.Value = False Then
For Each cell In ActiveSheet.Range("D10:D250")
If Not cell.Value = "APR" Then
cell.EntireRow.Hidden = True
End If
Next cell
Else
[10:250].EntireRow.Hidden = False
End If
End Sub
As you can see, i'm new to this :P
trying to achieve the following:
I have a toggle button that decides whether the condition in column c or in column g should be used, and resets the sheet to fully visible when switched.
I have 12 checkboxes that can be checked / unchecked and only the rows required are visible.
I have the following code per checkbox, which works fine if only that one Checbox is checked. Question is now how to code it when i check 2 or more Checkboxes and want to have the rows visible from all the checked checkboxes.
Private Sub CheckBox1_Click()
CheckBox1.Caption = "APR"
If CheckBox1 = True And ToggleButton1.Value = True Then
For Each cell In ActiveSheet.Range("G10:G250")
If Not cell.Value = "APR" Then
cell.EntireRow.Hidden = True
End If
Next cell
ElseIf CheckBox1 = True And ToggleButton1.Value = False Then
For Each cell In ActiveSheet.Range("D10:D250")
If Not cell.Value = "APR" Then
cell.EntireRow.Hidden = True
End If
Next cell
Else
[10:250].EntireRow.Hidden = False
End If
End Sub
As you can see, i'm new to this :P