I was baffled because the code you showed in your first post does not appear in this file. So I started from scratch. I have written code that does what I think you want.
First, never name anything "Name". That is because Name is a built-in attribute for many things in the VBA object model. When you refer to Me.Name, you are referring to the name of the userform, not the combobox. I have changed your combobox name to ShiftName. If you don't like that you can change it to anything you want.
Second, I have initialized your Shift combobox index to -1 so it is blank when first displayed. You want to force your user to make a selection, rather than mistakenly allowing them to select Green by doing nothing, which was displayed when the form came up. The only time you want a combobox to show a default value is when it is a true default, that is, you are OK if the user doesn't change it.
Also, here is a tip from a user interface design standpoint. Selecting the Name combobox doesn't make sense until you have first selected a value from the Shift combobox. So to enforce that order I have added code that disables Name until Shift has a selection.
Last, I strongly recommend to everyone that they
declare variables. Doing so prevents a lot of bugs and runtime errors.
Bookmarks