vijayendra.shukla
New Member
- Joined
- Jan 29, 2010
- Messages
- 34
Hi,
I am creating a dynamic UserForm in which i am creating a ComboBox. I want to populate the ComboBox dropdown with names of the sheets present in the workbook. UserForm is created successfully but ComboBox dropdown is always blank.
Here is the code:
As per the last line of the code, ComboBox is populated with the first index value of the drop-down, but when i try to click the drop down it is empty.
Let me know if I am missing anything here.
Thanks in advance.
I am creating a dynamic UserForm in which i am creating a ComboBox. I want to populate the ComboBox dropdown with names of the sheets present in the workbook. UserForm is created successfully but ComboBox dropdown is always blank.
Here is the code:
Code:
Set NewComboBox = TempForm.Designer.Controls.Add("Forms.combobox.1")
With NewComboBox
.Name = "cboProductGroups"
.Height = 15.75
.Left = 225
.Top = 24
.Width = 126
.BackColor = &H80000005
.ForeColor = &H80000008
' .Value = sProduct_Groups
' .Text = sProduct_Groups
.Enabled = True
End With
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then NewComboBox.AddItem ws.Name
Next ws
NewComboBox.ListIndex = 1
Let me know if I am missing anything here.
Thanks in advance.