Hi,
I have a collection and each and every item is an array of values.
I would like to find the value of items in that array in that collection. I can extract the values if I use For Each ... However, I would like to access directly and find the value.
The current code I have is:
I would like to access and get the value "student 2" directly, not using for each.Code:Sub TestCollection() Dim oTests As New Collection Dim var As Variant oTests.Add Array("student 1", "Maths", "90") oTests.Add Array("student 2", "history", "50") oTests.Add Array("student 3", "science", "80") For Each var In oTests 'var(0) 'Student 'var(1) 'subject 'var(2) 'marks Debug.Print var(0) Debug.Print var(1) Debug.Print var(2) Next var End Sub
Thank you




Reply With Quote