I've spent the last hour reading pages about variable scope in various flavours of excel vba, and could not find a definite documentation reference addressing my scope problem... even though i'm convinced it is such a classic. Oh well, here goes.
I've got a workbook that contains just one sheet and one userform. I have a list of students sitting in column 1 on my sheet. I would like to :
- load this list up into some global Collection variable named
students_list
(i do this using a Workbook-Open() procedure in the ThisWorkbook object) - use the contents of
students_list
to initialize a listbox in my userform - remove elements from
students_list
when a button on my userform is clicked on
All i need is a variable that is seen from within my userform's procedures, as well as from inside the ThisWorkbook object.
I tried declaring it as public, global, in the sheet's code, in the userform, in ThisWorkbook, in a separate module dedicated to globals... I just can't seem to find the right way to have the students_list
variable visible from everywhere.
What am I missing ? My apologies for this question that should be so basic and yet beats me :-/