Not sure about why its getting 'stuck' but if the range being run through is large, flopping the range's values into an array will speed things up.Originally Posted by vishwakarma
Not well tested but something like:
[vba]Function VlookupAll(rLookupVal As Variant, rTable As Range, lCol As Long) As Variant
Dim _
aryRangeVals As Variant, _
Result As String, _
x As Long, _
y As Long
Application.Volatile
VlookupAll = CVErr(xlErrNA)
aryRangeVals = rTable.Resize(, rTable.Columns.Count + lCol - 1).Value
For x = 1 To UBound(aryRangeVals, 1)
For y = 1 To UBound(aryRangeVals, 2) - (lCol - 1)
If rLookupVal = aryRangeVals(x, y) Then
Result$ = Result$ & "," & aryRangeVals(x, y + lCol - 1)
End If
Next
Next
If Len(Result$) Then
VlookupAll = Right(Result$, Len(Result$) - 1)
End If
End Function[/vba] Hope that helps,
Mark