我試圖得到多個VLOOKUP在單細胞多VLOOKUP結果
我得到#VALUE!錯誤與下面的功能,需要幫助糾正代碼
MultipleLookupNoRept(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer)
Dim i As Long
Dim Result As String
For i = 1 To LookupRange.Columns(1).Cells.Count
If LookupRange.Cells(i, 1) = Lookupvalue Then
For J = 1 To i - 1
If LookupRange.Cells(J, 1) = Lookupvalue Then
If LookupRange.Cells(J, ColumnNumber) = LookupRange.Cells(i, ColumnNumber) Then
GoTo Skip
End If
End If
Next J
Result = Result & " " & LookupRange.Cells(i, ColumnNumber) & ","
Skip:
End If
Next i
MultipleLookupNoRept = Left(Result, Len(Result) - 1)
End Function
你的代碼是偉大的,你忘了一個小東西,從你的'Function'返回'String'。將第一行修改爲'Function MultipleLookupNoRept(Lookupvalue As String,LookupRange As Range,ColumnNumber As Integer)As String',它可以爲你工作 –
謝謝但是我再次遇到同樣的錯誤 –
你怎麼使用它?您是從Excel工作表中輸入正確的參數? –