Anastomosis
Programmer
Hi, I have just started with VBA, and I have a question that I cannot seem to answer using the documentation or other web pages.
Are Collections immutable or something? If I add an element using Add, then try to change that value, it gives me a "Run-time error '424' Object required" error.
I have tried to use "Set myColl("Blue") = 5" and even "myColl(1) = 5". They all throw the same error.
If Collections are unchangeable, what's the point? Is there another container-like object which allows reference by keyword that allows you to actually change the values? (I would use an array, but I need to be able to access the data via keyword).
Are Collections immutable or something? If I add an element using Add, then try to change that value, it gives me a "Run-time error '424' Object required" error.
Code:
Dim myColl As New Collection
myColl.Add 2, "Blue"
myColl("Blue") = 5
I have tried to use "Set myColl("Blue") = 5" and even "myColl(1) = 5". They all throw the same error.
If Collections are unchangeable, what's the point? Is there another container-like object which allows reference by keyword that allows you to actually change the values? (I would use an array, but I need to be able to access the data via keyword).