1
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
VBA:此鍵已與此集合
在這條線:arr.Add a, a
我到底做錯了什麼?
mike即時通訊使用此代碼:http://stackoverflow.com/questions/3017852/vba-get-unique-values-from-array/3017973#3017973從數組中獲得唯一值 – 2010-06-11 16:49:21
是它的一個字符串 – 2010-06-11 16:50:31
你錯過了'On Error Resume Next',它省略了你的錯誤並繼續前進,因此你的獨特價值。 – Mike 2010-06-11 16:51:52