My question relates to storing multiple objects, created from a class, within a collection. To create each instance of the class, I loop through a multi-dimensional array; the array is populated from a variable range within a sheet in excel.
I am wondering if this is the most efficient method of creating a collection, when you wish to populate it from data within excel? Is there a more efficient way of doing this? I have just started using classes, so am still trying to find the best ways of working with them.
So firstly I populate the array from excel:
arrCars() = ws.Range(Cells(10, 1), Cells(mrow, 3)).Value
Then use the array to create a class object, and store the object within the collection.
For i = LBound(arrCars) To UBound(arrCars)
Set iCar = New CCarData
iCar.carModel = arrCars(i, 1)
iCar.carYr = arrCars(i,2)
iCar.carColour = arrCars(i,3)
clctCars.Add iCar
Next i
Any recommendations are appreciated. I couldn't find another post on this - apologies if there is one which I've been unable to find.