我有兩個數組,我試圖提取它們中的公共值,函數findUniques應該是返回字符串(它們是名字)連接在一起並用逗號分隔。我想我很接近,但我找不到什麼不對。我得到一個錯誤在第10行賦值左側的函數調用必須返回Variant或Object,在兩個數組中找到公共值
Function findUniques(astrArray1() As String, astrArray2() As String) As String
Dim blnMP5 As Boolean
blnMP5 = False
Dim counter1 As Long
Dim counter2 As Long
For counter1 = LBound(astrArray1) To UBound(astrArray1)
For counter2 = LBound(astrArray1) To UBound(astrArray2)
If astrArray1(counter1) = astrArray2(counter2) Then
blnMP5 = False
If blnMP5 = True Then
findUniques() = findUniques & "," & "astrArray1()"
End If
End If
Next counter2
Next counter1
End Function
完美!感謝您的幫助 – user2217895 2013-04-22 21:48:57
Kenneth在回答中可能確定了問題的原因。雖然目前的答案解決了OP的問題,但可能是由於刪除了導致錯誤的行。本文旨在說明使用輔助字符串變量來解決問題並不是強制性的。 – 2017-01-04 23:06:01