Home Ask Login Register

Developers Planet

Your answer is one click away!

Doug Coats February 2016

Userform Combo boxes Excel VBA

So kind of annoying because I have tried every suggestion that I have read so far, ut I cannot seem to get my user form combo boxes to be filled via VBA.

I have tried the following methods that seem to work for everyone but me....

 Me.Weeks.List = Array("30", "36", "40")


 With Weeks
     .AddItem "30"
     .AddItem "36"
     .AddItem "40"
 End With

And so far nothing shows up in the userform when I run it. Is there a setting I am missing? Of course these are part of the initialize event. :)


 Private Sub ToolBoxForm_Initialize()


Me.MinAYWeeks.List = Array("30", "36", "40")

'With MinAYWeeks
'    .AddItem "30"
'    .AddItem "36"
'    .AddItem "40"
'End With


 End Sub

There's also stuff that does calculations with the OK button, but nothing that affects the contents of the combobox, just stuff that references the value of the selected option.

Thanks in advance guys

enter image description here


SincereApathy February 2016

In your userform initialize event add your code, but add a reference to the userform (Me.Weeks).

With Me.Weeks
 .AddItem "30"
 .AddItem "36"
 .AddItem "40"
End With

enter image description here

Post Status

Asked in February 2016
Viewed 2,600 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life