I have tried these sites for help:
Would appreciate the help!
Here is my code:
Private Sub FusegearPerformanceUserForm1()
With FailureComboBox
.AddItem "japp"
End With
End Sub
I have tried these sites for help:
Would appreciate the help!
Here is my code:
Private Sub FusegearPerformanceUserForm1()
With FailureComboBox
.AddItem "japp"
End With
End Sub
Manipulation of controls in Excel confused me for a while until I realized that there are two kinds of them, and this might be part of your confusion. For example, there is:
a Form Control Combo Box, and,
an ActiveX Control Combo Box.
The two look, behave, and are controlled similarly, but not identically.
I realize that wasn't your question, but I figured I should make sure you can identify which control you are using, and therefore make sure that you're using (and Googling) the correct information - especially since the terms "Combo Box" and "Drop Down Box" are often used interchangeably. A Google Search for Vcode related to BA Combo Box Control will be wrong 50% of the time, so you need to be more specific.
AS for the code difference:
'add item
ActiveWorkbook.Sheets("Sheet1").Shapes("Drop Down 1").ControlFormat.AddItem "abcd"
'remove all items
ActiveWorkbook.Sheets("Sheet1").Shapes("Drop Down 1").ControlFormat.RemoveAllItems
'https://analysistabs.com/vba-code/activex-controls/combobox/
'add item
ActiveWorkbook.Sheets("Sheet1").ComboBox1.AddItem "abcd"
'remove all items
ActiveWorkbook.Sheets("Sheet1").ComboBox1.Clear
So, just for completion:
The solution to this question was, that the file was saved in the XLSX
format which cannot contain VBA code. After saving the file in the XLSM
format everything worked as expected.