我正在嘗試執行Vlookup以返回多個值。但是,該函數需要很長時間才能加載。有什麼辦法可以讓它更快嗎?我得到的功能從網上:https://www.extendoffice.com/documents/excel/2706-excel-vlookup-return-multiple-values-in-one-cell.htmlVlookup返回多個值
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
Dim rng As Range
Dim xResult As String
xResult = ""
For Each rng In pWorkRng
If rng = pValue Then
xResult = xResult & " " & rng.Offset(0, pIndex - 1)
End If
Next
MYVLOOKUP = xResult
End Function
這是在子
Sub sort()
Dim x As Integer
Dim result As Variant
Dim name As String
Application.ScreenUpdating = False
x = 10
Do Until IsEmpty(Sheet9.Cells(x, 1).Value)
name = Sheet9.Cells(x, 1).Value
result = MYVLOOKUP(name, Sheet9.Range("K:M"), 3)
Sheet9.Cells(x, 4).Value = result
x = x + 1
Loop
End Sub
當您獲得'*來自在線*的功能'時,對原始作者進行認證被認爲是很好的禮儀。 – Jeeped