Dmitry_D_Onishchenko
New Member
- Joined
- Nov 27, 2019
- Messages
- 18
- Office Version
- 365
- 2013
- 2010
- Platform
- Windows
Hi, I need to create a UserForm containing a ComboBox initialized with two pre-defined values. The UserForm code looks like this:
If I run the code, the results are as expected ONLY if the name of the UserForm is exactly 'UserForm'. Once I rename it to, say, 'UserForm2' (in the code and in the definitions tab simultaneously) it fails to initialize the ComboBox properly - a single blank value is seen in the drop-down list.
Please advise how this can be fixed.
Best regards,
Dmitry
VBA Code:
Private Sub UserForm_Initialize()
ComboBox1.AddItem "Value_A"
ComboBox1.AddItem "Value_B"
End Sub
If I run the code, the results are as expected ONLY if the name of the UserForm is exactly 'UserForm'. Once I rename it to, say, 'UserForm2' (in the code and in the definitions tab simultaneously) it fails to initialize the ComboBox properly - a single blank value is seen in the drop-down list.
Please advise how this can be fixed.
Best regards,
Dmitry