View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Populate combo box for Userform in Excel 2002

Myrna,

Presumably, if you run it from the Userform, you are saying that the form is
already visible. If so, the Show is going to error.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Myrna Rodriguez" wrote in message
...
Hi...
I created a UserForm containing 2 combo boxes.
UserForm will be used for data entry in excel.
I've enter the code in the module sheet.
When I run for module sheet, combo box displays list.
However when I run from Userform sheet, not successful.
Any guidance?? Where did I go wrong?
Thanks & have a happy day...
Myrna

This this code I've used:
Sub PopulateComboBox()
Dim MyArray As Variant
Dim MyStorage As Variant
Dim Ctr As Integer
MyArray = Array("Open", "Closed", "Cancelled")
MyStorage = Array("Open", "Archived", "Post-Close")
For Ctr = LBound(MyArray) To UBound(MyArray)
UserForm1.cbostatus.AddItem MyArray(Ctr)
UserForm1.cbostorage.AddItem MyStorage(Ctr)
Next

UserForm1.Show

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!