How EXCEL uses VBA data dictionary: summary after eliminating duplication

Here are the codes and comments:

Deputy General Manager ()

Set DIC = createobject ("scripting。 Dictionary ")' defines a dictionary.

Arr = Range("A 1:C500 ")' Assuming the maximum number of rows is 500, put the area from A 1 to C500 into the array.

For I = 1 to bound (arr)' The maximum number of rows to loop from 1 into the array.

If arr(i, 1)& lt; & gt ""and arr(i,1) < > "equipment" then suggests a space and a title line.

Dic (ARR (I, 1)) = DIC (ARR (I, 1))+ARR (I, 3)' Use the dictionary to delete duplicates and accumulate numbers.

If ... it will be over.

Next, I

[E2]。 Resize (DIC. Count, 1) = application. Transpose (DIC. Keys)' transpose the keys of the dictionary (that is, the values that are not repeated in column A) into column E.

[F2]。 Resize (DIC. Count, 1) = application. Transpose (DIC. Items)' transposes the dictionary's kItems (that is, cumulative results) and puts them in the E column.

End joint