Hello There,
I have a checkbox 'CheckBoxShowSummary' in a userform. When it is checked the columns C:J are displayed, else it is hidden (please find the code below).
When the form shows up, this is what I am looking for in the code to perform:
1. Check if the columns C:J are hidden, then the checkbox should have a value False. If columns C:J are displayed, then it should have the value True.
2. Instead of hard coding the columns (C:J), is there a smarter way to do like using via the Named Range.
Could you please advise on how the above can be achieved?
Thanks & regards
Don
I have a checkbox 'CheckBoxShowSummary' in a userform. When it is checked the columns C:J are displayed, else it is hidden (please find the code below).
When the form shows up, this is what I am looking for in the code to perform:
1. Check if the columns C:J are hidden, then the checkbox should have a value False. If columns C:J are displayed, then it should have the value True.
2. Instead of hard coding the columns (C:J), is there a smarter way to do like using via the Named Range.
Could you please advise on how the above can be achieved?
Code:
Private Sub CheckBoxShowSummary_Click()
If CheckBoxShowSummary = True Then
Sheets("Sheet1").Columns("C:J").EntireColumn.Hidden = False
Else
Sheets("Sheet1").Columns("C:J").EntireColumn.Hidden = True
End If
End Sub
Thanks & regards
Don