combine cells

painnbt

New member
Joined
Apr 8, 2015
Messages
7
Reaction score
0
Points
0
I have two columns one is product SKU's the other is the product fitment. If a sku has more then one fitment it repeats the sku and adds the fitment. I want some way of finding all matching skus and combining the fitments into one sku.
 

Attachments

  • Untitled1.png
    Untitled1.png
    12 KB · Views: 18
  • Untitled2.png
    Untitled2.png
    6.2 KB · Views: 11
The first image shows what my data looks like. the second what i need it to look like
 
I updated the example the first page shows example data the second page shows what i would like it to look like when done
 

Attachments

  • example.xlsx
    9.7 KB · Views: 14
Hi painnbt

Try this
Code:
Option Explicit
Sub test()
   Dim ws As Worksheet
   Dim LR As Long, i As Long
   Set ws = Sheets("Before")
   Application.ScreenUpdating = False
   With ws
      LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                       SearchDirection:=xlPrevious).Row
      For i = LR To 2 Step -1
         If .Range("A" & i).Offset(-1, 0).Value = .Range("A" & i).Value Then
            .Range("B" & i).Offset(-1, 0).Value = .Range("B" & i).Offset(-1, 0).Value & " | " & .Range("B" & i).Value
            .Range("A" & i).EntireRow.Delete
         End If
      Next i
   End With
   Application.ScreenUpdating = True
End Sub
 
Back
Top