vba:这个键已经和这个集合的元素关联了

Dim arr As New Collection, a Dim aFirstArray() As Variant ...some code For Each a In aFirstArray arr.Add a, a Next 

我得到这个错误: This key is already associated with an element of this collection

在这一行上: arr.Add a, a

我究竟做错了什么?

更多的代码?

从这个你所有我可以告诉你是什么你的错误说。 a已经在集合中( 关键字应该是唯一的string )。 BTW。 是一个string?

或者,也许你有一些重复在你的数组,这将试图增加1 +时间相同的项目?