Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Populate combo box for Userform in Excel 2002

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Populate combo box for Userform in Excel 2002

Hi Bob,

The UserForm displays when I run but does not populate the combo boxes.

In MyModule I have the following code to display form:
Sub ShowDialog()
UserForm1.Show
End Sub

When I select MyModule & run program the combo box populates. confused?
thanks for your immediate response!
myrna



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Populate combo box for Userform in Excel 2002

So where is the populate routine called?

--

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 Bob,

The UserForm displays when I run but does not populate the combo boxes.

In MyModule I have the following code to display form:
Sub ShowDialog()
UserForm1.Show
End Sub

When I select MyModule & run program the combo box populates. confused?
thanks for your immediate response!
myrna



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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Populate combo box for Userform in Excel 2002

The populate routine is in MyModule.
Still having trouble viewing items in combo box.
A day of mind tingling fluster...

Sub ShowDialog()
UserForm1.Show
End Sub

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!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Populate combo box for Userform in Excel 2002

Myrna,

If you want to populate the combobox, you need to call the PopulateComboBox
routine from somewhere within the userform initialisation code. But you
also need to remove the Userform1.Show within it.

--

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
...
The populate routine is in MyModule.
Still having trouble viewing items in combo box.
A day of mind tingling fluster...

Sub ShowDialog()
UserForm1.Show
End Sub

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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't get the Erlang formula in Excel 2002 to populate...help MK Excel Worksheet Functions 2 September 29th 05 03:54 AM
Can I copy a combo box in Excel 2002 with a relative cell link? Bozo Excel Discussion (Misc queries) 1 February 17th 05 02:05 AM
Trouble w/ ActiveX Controls (no userform) Excel 2002. Chris Excel Programming 2 November 14th 03 06:36 PM
Importing Userform in Excel 2002 Vasant Nanavati[_2_] Excel Programming 0 August 19th 03 01:26 AM
Using an ActiveXDll with Excel 2002 when the DLL uses a VB Form and VBA uses a Userform Howard Kaikow Excel Programming 6 August 3rd 03 07:31 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"