View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brian Andrus Brian Andrus is offline
external usenet poster
 
Posts: 1
Default Workbook_Open and ComboBox

I want to run the following code when my worksheet is open:
---------------------
Sheets("Event Setup").Activate
'Clear ListBox
For Count = 1 To ComboBox1.ListCount
ComboBox1.RemoveItem (0)
Next
ComboBox1.AddItem ("<Select Vendor")

NumberOfVendors = Range("NumberOfVendors").Value
Count = 1
Do While (NumberOfVendors = Count)
VendorName = Range("E" & Count).Value
MsgBox (VendorName)
ComboBox1.AddItem (VendorName)
Count = Count + 1
Loop
ComboBox1.ListIndex = 0
------------------------------

I put it in a Workbook_Open macro, but get an error:
"object required: on the ComboBox1.ListCount line.

How can I run this code when my workbook is opened?