1

I have a userform with a combobox and multiple textboxes. I used the BeforeUpdate event for the combobox to determine which boxes in the field were enabled at a given time. The problem I have is, everytime I change the combobox the boxes aren't enabled or disabled until I click on one of them. Is it possible to refresh all of the boxes after the combobox selection is made? I've included a sample of the code I'm using; there are 27 textboxes that are enabled or disabled depending on 6 different combobox options.Thanks!

Private Sub AdminCombo_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    If AdminCombo = "Composite" Then
        AdminCompCurr.Enabled = True
        AdminCompRenNum.Enabled = True
        AdminCompRenPer.Enabled = True
        AdminEEOnlyCurr.Enabled = False
        AdminEEOnlyRenNum.Enabled = False
        AdminEEOnlyRenPer.Enabled = False
    End If
End Sub
2
  • 1
    What happens if you use the AdminCombo_AfterUpdate event instead? Commented Jan 17, 2014 at 21:01
  • 1
    Thanks! It actually didn't help it, but I tried AdminCombo_Change() event and it worked perfectly. Commented Jan 17, 2014 at 22:03

1 Answer 1

1

So we have the answer here for future use.

Change the line:

Private Sub AdminCombo_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)

to

Private Sub AdminCombo_Change(ByVal Cancel As MSForms.ReturnBoolean)

This uses the event after the combobox is changed to update the needed textboxes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.