Hello all: The below code combines duplicates, it Looks in Column A (Item Number), combines Column B (Quantities) and puts it on sheet2. My Question is can this be modified to add Column C (Description) data on sheet2 also? Thanks Dan
Sub test()
Dim dic As Object, x, y
Dim r As Range
Set dic = CreateObject("Scripting.Dictionary")
For Each r In Range("A1", Range("A65536").End(xlUp))
If Not IsEmpty(r) Then
If Not dic.exists(r.Value) Then
dic.Add r.Value, r.Offset(, 1).Value
Else
dic(r.Value) = dic(r.Value) + r.Offset(, 1).Value
End If
End If
Next
x = dic.keys: y = dic.items
If dic.Count < 1 Then Exit Sub
With Sheets("sheet2").Range("a1")
.Resize(UBound(x) + 1).Value = Application.Transpose(x)
.Offset(, 1).Resize(UBound
+ 1).Value = _
Application.Transpose![Thumbs up (y) (y)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
End With
End Sub
Sub test()
Dim dic As Object, x, y
Dim r As Range
Set dic = CreateObject("Scripting.Dictionary")
For Each r In Range("A1", Range("A65536").End(xlUp))
If Not IsEmpty(r) Then
If Not dic.exists(r.Value) Then
dic.Add r.Value, r.Offset(, 1).Value
Else
dic(r.Value) = dic(r.Value) + r.Offset(, 1).Value
End If
End If
Next
x = dic.keys: y = dic.items
If dic.Count < 1 Then Exit Sub
With Sheets("sheet2").Range("a1")
.Resize(UBound(x) + 1).Value = Application.Transpose(x)
.Offset(, 1).Resize(UBound
Application.Transpose
End With
End Sub