How about this
Option Explicit
Sub MakeReport()
Dim WsData As Worksheet, WsReport As Worksheet
Dim NameRng As Range, CurName As Range
Dim JobRng As Range, JobItem As Range
Dim LastRow As Long 'Multiple use
Dim ReportRowCounter As Long
Dim JobRolesStr As String, DescriptionStr As String
Dim FullNameStr As String, CurFullNameStr As String
Set WsData = Sheets("Data")
Set WsReport = Sheets("Report")
'Set all ranges
LastRow = WsData.Cells(WsData.Cells.Rows.Count, "A").End(xlUp).Row
Set NameRng = WsData.Range("A3:A" & LastRow + 1)
LastRow = WsData.Cells(WsData.Cells.Rows.Count, "F").End(xlUp).Row
Set JobRng = WsData.Range("F3:F" & LastRow)
'Clean report
WsReport.Range("A3", WsReport.Cells.SpecialCells(xlCellTypeLastCell)).ClearContents
ReportRowCounter = 3 'Start at row 3.
FullNameStr = ""
For Each CurName In NameRng
CurFullNameStr = Trim(CurName) & " " & Trim(CurName.Offset(0, 1))
If CurFullNameStr <> FullNameStr Then 'Unequal to previous
If FullNameStr <> "" Then
WsReport.Cells(ReportRowCounter, "A") = FullNameStr
WsReport.Cells(ReportRowCounter, "B") = Right(JobRolesStr, Len(JobRolesStr) - 3)
WsReport.Cells(ReportRowCounter, "C") = Right(DescriptionStr, Len(DescriptionStr) - 3)
ReportRowCounter = ReportRowCounter + 1
End If
FullNameStr = CurFullNameStr
JobRolesStr = ""
DescriptionStr = ""
End If
JobRolesStr = JobRolesStr & ", " & Chr(10) & CurName.Offset(0, 3)
For Each JobItem In JobRng
If JobItem = CurName.Offset(0, 3) Then DescriptionStr = DescriptionStr & ", " & Chr(10) & JobItem.Offset(0, 2)
Next
Next
End Sub
Note that your Namestring are not the same and they contain spaces.
Bookmarks