Open Excel
Press Alt + F11
Right click on VBAProject > Insert > Class
Specify the Name for the VBA class "Person" in the left hand pane, properties dialog
Give the Person class a property eg firstname
Public FirstName As String
Create a second class or module file and here is how to create/access an array of the People class:
Public colOfPeople As New Collection
Public Function MakePeople() As String
Dim clsP As New clsPerson
clsP.FirstName = "Jeremy"
colOfPeople.Add (clsP)
End Function
Solution 1: To make this multi-dimensional, I've made the collection an array:
Public multiColOfPeople() As New Collection
Public Function MakeMultiPeople() As String
ReDim Preserve colOfPeople(1) 'dimension multi-array collection
Dim clsP As New clsPerson
clsP.FirstName = "Jeremy"
colOfPeople(0).Add (clsP)
Dim clsP1 As New clsPerson
clsP1.FirstName = "Lisa"
colOfPeople(1).Add (clsP1)
End Function
Solution 2: Using a multi-dimensional array (no collection)
Public multiArray(3, 3) As New clsPerson
Dim clsP As New clsPerson
'store
multiArray(0, 1) = clsP
'retrieve
clsP = multiArray(0, 1)
Edit *
To use the second solution, see chris neilsen's answer for info on ReDim'ing multidimensional arrays