So I have the code that pastes multiple values into one cell but I was hoping to be able to put a semicolon in between the cell's value.
This code allows a vlookup to find multiple cell values and output them in one cell.
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
'Update 20150310
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
When I do this it does put a semicolon in between the values like I want, but also has a billion semicolons after.
Debug.Print rng.Offset(0, pIndex - 1)
beforexResult = xResult & ";" & rng.Offset(0, pIndex - 1)
and see what that's returning? – dwirony=TEXTJOIN(";",TRUE,IF(A1:A1000="MyValue",D1:D1000,""))
As an Array Formula with Ctrl-Shift-Enter – Scott Craner