I have a VBA that create a custom Vlookup code, but whenever it generates a line at the beginning of the result. Can anyone help me?
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
'Update 20150310
For Each rng In pWorkRng
If rng = pValue Then
xResult = xResult & vbNewLine & rng.Offset(0, pIndex - 1)
End If
Next
MYVLOOKUP = xResult
End Function
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
'Update 20150310
For Each rng In pWorkRng
If rng = pValue Then
xResult = xResult & vbNewLine & rng.Offset(0, pIndex - 1)
End If
Next
MYVLOOKUP = xResult
End Function