Hello and thanks to all that replied for the replies, questions & suggestions
Not sure why you think a named range is required but.
And not sure why you think you need all this much code to just load a worksheet Combobox with value.
"
My Aswer Is This": Thank you for your help with the code you supplied.
To answer your question, my short answer is this:
"it’s for simplification and consistency that come with using the same named range for an entry regardless of whether the combobox is on a userform, or on a spreadsheet within my workbook"
If you would like a better, more detailed explanation, please continue reading below where I provide a description of my workbook including its function as well as how the parts of it that are applicable to my original request work.
I didn't want to get into too much background on my workbook and its code if for nothing else than to just keep it simple with my request and not drown the reader with information over-load... but I see now I should of provided at least
some information as to why I am attempting to do exactly what it is that I am asking:
So the workbook I am working on is one that has been growing (both in size in regard to the number of entries as well as complexity with the number of forms and code within it) for several years now.
When I first created it about 3 years ago, the main worksheet (example shown below) contains within the first 16 rows a "summary area" that when the workbook is opened it calculates various metrics based on the previously entered data (from row 18 down to the last row, which is now sitting at 699.) The data that is entered and added to a new row each time a user adds an entry is a "quality incident" and that entry must be added via a userform. One form is for entries, and another userform is for revising a previously entered incident.
The main worksheet page looks like this:
<pic of main worksheet>
The middle section (right below where is says: "SUMMARY OF EVENTS" in columns I & J) of the above pictured spreadsheet contains 4 comboboxes (these are the ones I am asking my question about) that will
FILTER that particular column (example, the combobox for “CUSTOMER NAME” will filter column G which is the “Customer” column.)
All the way over to the left you will see a bright green command button labeled "ID#". Each column has a button like this that will SORT everything based on the values in that column. So the user can either
filter the data from either of the 4 comboboxes, and/or then
sort the data by clicking on any of the command buttons for each column. When a command button is selected, it sorts the data AND turns that particular button GREEN so that the user can see which column is currently being sorted. This is the setup/design I came up with 3 years ago when I created this.
I have a separate worksheet just for
named ranges that are accessed via (multiple) userforms... which, btw, all function just fine. I am now getting to the reason for my original question (yes, finally
)... Although I have no problems with my existing code as it pertains when using the named ranges
WITH USERFORMS, I cannot figure out how to do the same with comboboxes on a worksheet.
<pic of named ranges worksheet>
The comboboxes on my WORKSHEET have always been populated when the workbook is opened (on open event) and using the .AddItem function.
<pic of on open event code>
Using the ".Additem" method works well enough, BUT... In several cases I have the same function for a combobox (for selecting an employee 'Name', for example) on userforms (where the data for populating those boxes are retrieved from named ranges)
and on a spreadsheet (where they are populated using the “.AddItem” as described above.)
My named ranges that are on a separate worksheet are all dynamic ranges because whenever a user goes to select a choice from a combobox, and it’s not there (choices are ‘MatchRequired’), they then have the option of selecting a command button that will then trigger a pop-up form where they can then add the name they need and at which time it will then be inserted into the specific named dynamic range for that combobox (sure hope that all makes sense…)
<pic of userform for entering a new incident>
So now we have arrived (finally, I know
) at the reason why I want to keep my comboboxes that are on the WORKSHEET referring to the
same named range that the comboboxes on my userforms refer to: it’s for the simplification and consistency that come with using the same named range for an entry regardless of whether the combobox is on a userform, or is on a spreadsheet within my workbook.
I'm sure this is something really simple that I am missing, but I also hope that by me providing a description of how my workbook functions and its purpose, maybe some of you folks will have a suggestion for handling this in another, more efficient or simpler way. Everything I know about VBA and excel I learned from this site and from the much more advanced and smarter experts folks than I am .
As always, thanks again for everyone's help and guidance. It is very much appreciated.