Hi I am not experienced in VBA so please if possible respond in context.
I have a workbook with a globally defined named range "MyArray" which refers to a constant array = {"Item1","Item2","Item3"}
My general module contains the following
UserForm1 contains just four objects:![]()
Please Login or Register to view this content.
CommandButton1 displays "OK"
CommandButton2 displays "Cancel"
ComboBox1
Label1 describes ComboBox1
What I am trying to achieve is this:
If at any time the user clicks "Cancel", the UserForm1 is unloaded and bResponse is returned False. Otherwise:
User clicks the dropdown arrow on the ComboBox and a list appears containing the values in MyArray.
User selects a value from that drop down list and confirms by clicking "OK".
That newly selected value is then assigned to the variable sComboVal
And then the routine in the general module that called the userform undertakes various actions based on the newly assigned value of sComboVal.
So far, all I have managed to achieve in the code behind the userform is to define what happens when the user clicks OK or cancel, thus:
At this point I get lost, that is to say programming the code for the ComboBox1,![]()
Please Login or Register to view this content.
(a) so that it lists the values of MyArray, and
(b) to assign to sComboVal the value selected from that list by the user.
Can someone please help me with these last steps (and correct any obvious errors so far)?
Thanks
Bookmarks