I have a collection of employees (object) and each employee has his/her own properties(attributes) such as ID, Age, etc. I have defined a class module (named clsemployee) as below:
Public ID As Integer Public Age As Integer . .
And I added the properties of ID, age and etc. to the collection as below in a module:
Public Sub employee_collection() ' this collection saves all of the employees records
Dim employee As Collection
Set employee = New Collection
Dim n As Integer
Dim i As Integer
Dim E1 As Variant
Dim j As Integer
n = 528
Dim a, b As String
For i = 3 To n
a = "A" + CStr(i) ' to get the values from the excel sheet
b = "B" + CStr(i)
Set E1 = New clsEmployee
E1.ID = Sheets("A").Range(a).Value ' save the valus of each employee in the collection
E1.Age = Sheets("A").Range(b).Value
employee.Add E1
Next i
End Sub
I do not know how to call this collection in my other modules (sub). Should I call it by value or call by reference? I do not want to repeat defining this employee in each and every sub that I have.