Populate Combobox

G

Guest

I have a combobox in a worksheet and on a userform, both containing the exact
same choices. As soon as a different choice is made in the combobox on my
worksheet, my userform opens. I am struggling with getting the new item
choice from my worksheet populated into the combobox on my userform.

If Sheets("Sheet1").Range("F434").Value = 1 Then
frmFields.txtActivityCmb.ListIndex = 0
End If

I've tried adding the code to UserFrom_Activate, which doesn't work. It does
work when added the code to a macro assigned to the combobox in the
worksheet. But, it doesn't work until the the combobox selection is made a
second time. I think that when the userform is opening, it's not catching
the update in the worksheet yet. Any ideas how I can change the code to
update the change in the worksheet before opening the userform. I don't want
to save the worksheet though; I'd like the user to be able to decide if they
want to save it. Thanks for your help.
 
G

Guest

Not sure what you are trying to do, but maybe this will help you get there.
Combo boxes do not exist until they are loaded and when they are unloaded
they no longer exist. You cannot assign a value to a combo box that does not
exist. So to do what it looks like you are trying to do, both combo boxes
must be loaded at the time you try to assign the value of one to the other.
HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top