As we know, the Initialize Event of a userform is a very 'busy person', meaning for large and maybe complicated userforms with lots of things happening in them, we may need to equally have lots of things happening in the Initialize Event of a userform.
I am illustrating an example below in a 'less busy' userform but with a problem that can be encountered in a busier form with more data:
Below you will see the existing code in a userform, which essentially first displays a welcome message and then shows a userform:
ini1.png
Some new data needs to be added to the Initialize Event for the combobox function as shown below:
ini2.png
However the below error is received:
ini3.png
But the error is gone when the code is placed as below:
ini4.png
I have tried separating both codes with End Sub and End With etc. but no luck.
My question is, how are several codes in the Initialize Event usually separated (for example in this current example) rather than piling them on top of each other like I did to achieve resolution here? Some folks may go the other way and create an alternative way to code the comboboxes without using the Initialize Event, but in my opinion, running from matters like those gets rid of the symptoms, but the illness is still there.
The code is below and the workbook is attached. I appreciate your advice.
Bookmarks