I have inserted 4 ActiveX controls onto a worksheet - 2 OptionButtons and 2 ListBoxes. I've also written code so that when OptionButton1 is chosen, only ListBox1 is visible (and enabled) and when OptionButton2 is chosen, only ListBox2 is visible (and enabled). The ListBoxes appear and disappear as they should when using the OptionButtons, but I'm running into the following problem:
1.ListBox1 works
2.I click OptionButton2
3.ListBox1 goes away and ListBox2 appears
4.ListBox2 works
5.I click OptionButton1
6.ListBox2 goes away and ListBox1 appears
7.ListBox1
now doesn't work
8.I click OptionButton2
9.ListBox1 goes away and ListBox2 appears
10.Now ListBox2 doesn't work (I originally thought it was just a problem with ListBox1, but it was a problem with both)
11.I click OptionButton1 and ListBoxes change again
12.we're back to step 1, with ListBox1 working again.
Here's the code behind it:
Code:
Private Sub OptionButton1_Change()
If OptionButton1.Value = True Then
With ActiveSheet
.ListBox2.Visible = False
.ListBox2.Enabled = False
.ListBox1.Visible = True
.ListBox1.Enabled = True
.ListBox1.ListIndex = 0
End With
Else
With ActiveSheet
.ListBox1.Visible = False
.ListBox1.Enabled = False
.ListBox2.Visible = True
.ListBox2.Enabled = True
.ListBox2.ListIndex = 0
End With
End If
End Sub
Code:
Private Sub ListBox1_Change()
Select Case ListBox1.ListIndex
Case 3
ActiveSheet.ComboBox2.Visible = True
ActiveSheet.ComboBox2.Enabled = True
If ActiveSheet.Range("O2").Value <> ActiveSheet.Range("O3").Value Then
Call LoadClients
End If
Case Else
ActiveSheet.ComboBox2.Visible = False
ActiveSheet.ComboBox2.Enabled = False
End Select
End Sub
Can anyone help me out? I (obviously) have no clue why this is happening.
