Hello All,
I am using an VBA code:- Range("20:100").EntireRow.Hidden = True and Range("20:100").EntireRow.Hidden = False to hide and unhide the rows based on some conditions.
Some of this rows contains checkboxes within cell. Hence I want the checkboxes in rows to hide as well when the entire row is hidden. Now when rows gets hidden the checkboxes stack up on top of one another.
I have used the below code but it is not giving any result. Is there any correction required in the code?
Your assistance will be highly appreciated. Thankyou in advance.
[
Private Sub CommandButton1_Click()
Dim Chk As CheckBox
For Each Chk In ActiveSheet.CheckBoxes
Chk.Placement = xlMoveAndSize
If Not Intersect(Chk.TopLeftCell,Range("20:100")) Is Nothing Then
With Chk
.Visible = Not .Visible
End With
End If
Next Chk
With ActiveSheet.Range("20:100").EntireRow
.Hidden = Not .Hidden
End With
End Sub
]
I am using an VBA code:- Range("20:100").EntireRow.Hidden = True and Range("20:100").EntireRow.Hidden = False to hide and unhide the rows based on some conditions.
Some of this rows contains checkboxes within cell. Hence I want the checkboxes in rows to hide as well when the entire row is hidden. Now when rows gets hidden the checkboxes stack up on top of one another.
I have used the below code but it is not giving any result. Is there any correction required in the code?
Your assistance will be highly appreciated. Thankyou in advance.
[
Private Sub CommandButton1_Click()
Dim Chk As CheckBox
For Each Chk In ActiveSheet.CheckBoxes
Chk.Placement = xlMoveAndSize
If Not Intersect(Chk.TopLeftCell,Range("20:100")) Is Nothing Then
With Chk
.Visible = Not .Visible
End With
End If
Next Chk
With ActiveSheet.Range("20:100").EntireRow
.Hidden = Not .Hidden
End With
End Sub
]