Excel VBA – Combine rows with duplicate values in one cell and merge values in other cell
Try changing your code to this: Sub mergeCategoryValues() Dim lngRow As Long With ActiveSheet lngRow = .Cells(65536, 1).End(xlUp).Row .Cells(1).CurrentRegion.Sort key1:=.Cells(1), Header:=xlYes Do If .Cells(lngRow, 1) = .Cells(lngRow – 1, 1) Then .Cells(lngRow – 1, 3) = .Cells(lngRow – 1, 3) & “; ” & .Cells(lngRow, 3) .Cells(lngRow – 1, 4) = .Cells(lngRow – 1, 4) … Read more