Forum Discussion
Nefe1930
Feb 16, 2024Copper Contributor
Hide activebox when active box is checked
I'm trying to hide an Activebox when it's checked and visible when not. The code I was trying is this: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then ActiveSheet.CheckBox1.Visible = ...
- Feb 16, 2024
Perhaps like this?
Private Sub CheckBox1_Click() Me.CheckBox1.Visible = Not Me.CheckBox1.Value Me.CheckBox2.Visible = Me.CheckBox1.Value Application.EnableEvents = False Me.CheckBox2.Value = Not Me.CheckBox1.Value Application.EnableEvents = True End Sub Private Sub CheckBox2_Click() Me.CheckBox2.Visible = Not Me.CheckBox2.Value Me.CheckBox1.Visible = Me.CheckBox2.Value Application.EnableEvents = False Me.CheckBox1.Value = Not Me.CheckBox2.Value Application.EnableEvents = True End Sub
HansVogelaar
Feb 16, 2024MVP
Perhaps like this?
Private Sub CheckBox1_Click()
Me.CheckBox1.Visible = Not Me.CheckBox1.Value
Me.CheckBox2.Visible = Me.CheckBox1.Value
Application.EnableEvents = False
Me.CheckBox2.Value = Not Me.CheckBox1.Value
Application.EnableEvents = True
End Sub
Private Sub CheckBox2_Click()
Me.CheckBox2.Visible = Not Me.CheckBox2.Value
Me.CheckBox1.Visible = Me.CheckBox2.Value
Application.EnableEvents = False
Me.CheckBox1.Value = Not Me.CheckBox2.Value
Application.EnableEvents = True
End Sub
- Nefe1930Feb 20, 2024Copper Contributor
Ok that works however when box 2 is clicked box 1 reappears. I'd like to have it if box 2 is clicked box 1 is still hidden, box 2 is hidden, and a new box is visible.
- HansVogelaarFeb 20, 2024MVP
How many check boxes do you want to use?
- Nefe1930Feb 20, 2024Copper ContributorGot alot! LOL doing up a form