HI All,
I have searched google but am not finding exactly what I need. I am so clueless when it come to VBA any attempts I make to modify codes only result in errors.
I have a two tab workbook going. Tab 2 has Columns A-H. This tab is listing every result for every owner in my system. Column A is the owner number(unique to each owner) Column D shows the product they received. My system generated report generates a row for each product each owner has received. So owner 1234 could have 50 rows because they received 50 products. On tab 1 I am combining the data from tab 2 onto one line per owner number. I have used SUMIF to get the total of all products per owner number. Now I need a way to pull the product names(Column D) for each owner number from tab 2, combine/concatenate into one cell (Column E) on tab 1. I tied a code that almost did it but that code was programed to work in one Tab only and its results did not eliminate duplicates or add in a Delimiter. If that code had been able to remove duplicates and put a comma between results, I could have at least cut and pasted into tab 1.
Any help would be great!! Thank You all in Advance!
Here is the code that almost worked:
Code:
Function MYVLOOKUP(lookupval, lookuprange As Range, indexcol As Long)
Dim r As Range
Dim result As String
result = ""
For Each r In lookuprange
If r = lookupval Then
result = result & " " & r.Offset(0, indexcol + 1)
End If
Next r
MYVLOOKUP = result
End Function
Bookmarks