K
Knutsel
Hello,
I'm using a macro to hide certain rows based on clicking a checkbox.
Normaly the rows I want to hide are laying beneith each other but now
I want to hide rows who are lying separate.
The macro code I have bin using so far (for hiding group 1) is this :
--------------------------------------------------------------------------------
Private Sub CheckBox1_Click()
BeginRow = 2
EndRow = 4
ChkCol = 1
If CheckBox1.Value = True Then
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Next RowCnt
Else
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Next RowCnt
End If
End Sub
--------------------------------------------------------------------------------
An example of the data would be something like :
groep naam
1 eik
1 den
1 beuk
2 appel
2 kers
2 aardbei
--------------------------------------------------------------------------------
In the new situation the data would be something like :
groep naam
1 eik
1 den
1 beuk
2 appel
1 kers
2 aardbei
--------------------------------------------------------------------------------
How can I change the range of rows in the macro so that it hide all
the "groep 1" rows on the click of the checkbox ?
Any help is appriciated.
Nico
I'm using a macro to hide certain rows based on clicking a checkbox.
Normaly the rows I want to hide are laying beneith each other but now
I want to hide rows who are lying separate.
The macro code I have bin using so far (for hiding group 1) is this :
--------------------------------------------------------------------------------
Private Sub CheckBox1_Click()
BeginRow = 2
EndRow = 4
ChkCol = 1
If CheckBox1.Value = True Then
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Next RowCnt
Else
For RowCnt = BeginRow To EndRow
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Next RowCnt
End If
End Sub
--------------------------------------------------------------------------------
An example of the data would be something like :
groep naam
1 eik
1 den
1 beuk
2 appel
2 kers
2 aardbei
--------------------------------------------------------------------------------
In the new situation the data would be something like :
groep naam
1 eik
1 den
1 beuk
2 appel
1 kers
2 aardbei
--------------------------------------------------------------------------------
How can I change the range of rows in the macro so that it hide all
the "groep 1" rows on the click of the checkbox ?
Any help is appriciated.
Nico