Bagharmin
Board Regular
- Joined
- Nov 22, 2010
- Messages
- 168
I have two OptionButtons and two ListBoxes. When I click on OptionButton2, ListBox1 goes away and ListBox2 becomes visible and enabled. When I click OptionButton1, ListBox2 goes away and ListBox1 becomes visible and enabled and I set the ListIndex of ListBox1 to 0.
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
When I click in ListBox1, some other code is supposed to make a ComboBox visible and populate it if the user chooses a certain item in the ListBox or take the ComboBox away if they choose something else in the ListBox:
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
My problem is this: When I go back to OptionButton1, I can't click in ListBox1 at all. I have to go back to OptionButton2, then back to OptionButton1 before I can choose any of the 4 entries in ListBox1. Obviously I don't want people who use this to have to do that every time. Can anyone tell me how to fix this?
Every other time that I go to OptionButton2, then back to OptionButton1, ListBox1 becomes unclickable.
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
When I click in ListBox1, some other code is supposed to make a ComboBox visible and populate it if the user chooses a certain item in the ListBox or take the ComboBox away if they choose something else in the ListBox:
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
My problem is this: When I go back to OptionButton1, I can't click in ListBox1 at all. I have to go back to OptionButton2, then back to OptionButton1 before I can choose any of the 4 entries in ListBox1. Obviously I don't want people who use this to have to do that every time. Can anyone tell me how to fix this?
Every other time that I go to OptionButton2, then back to OptionButton1, ListBox1 becomes unclickable.