Reputation: 23
I am trying to unlock a combobox when a option button is enabled. I am using the following code in a module but when I run the code and select the option the combo box remains locked
If Custom = True Then
FromMonth.Locked = False
FromYear.Locked = False
ToMonth.Locked = False
ToYear.Locked = False
End If
I am hoping to find a way to simultaneously click the option button in the userform and have it unlock the combo boxes next to them
Upvotes: 1
Views: 559
Reputation: 357
You can use the option button change event, and make sure to add the code into userform code module and not the normal module
Your code can be something like this
Private Sub Custom_Change()
FromMonth.Locked = Not Custom.Value
FromYear.Locked = Not Custom.Value
ToMonth.Locked = Not Custom.Value
ToYear.Locked = Not Custom.Value
End Sub
Upvotes: 1