mehidy1437
Active Member
- Joined
- Nov 15, 2019
- Messages
- 348
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
- Mobile
- Web
hi,
how can I add column 1,2,3 here instead of column 3 only?
I want to compare three column to get the unique value.
Full Code
how can I add column 1,2,3 here instead of column 3 only?
I want to compare three column to get the unique value.
Code:
str=ar(i, 3)
Full Code
VBA Code:
Option Explicit
Sub SumandRemove()
Dim ar As Variant
Dim i As Long
Dim j As Long
Dim n As Long
Dim str As String
n = 1
ar = Sheet1.Cells(10, 1).CurrentRegion.Value
With CreateObject("Scripting.Dictionary")
For i = 2 To UBound(ar, 1)
str = ar(i, 3)
If Not .exists(str) Then
n = n + 1
For j = 1 To UBound(ar, 2)
ar(n, j) = ar(i, j)
Next
.Item(str) = n
Else
For j = 7 To UBound(ar, 2)
ar(.Item(str), j) = ar(.Item(str), j) + ar(i, j)
Next
End If
Next
End With
Sheet2.Range("A1").Clear
Sheet2.Range("A1").Resize(n, UBound(ar, 2)).Value = ar
End Sub