Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Ask for help to explain VBA code
Ask for help to explain VBA code
Child save ()

Dim arr, brr, d, i& define array arr, array brr, d object, and I is a long integer.

Set d = createobject ("scripting.dictionary")' d is specified as a dictionary object.

Sheet 1。 Activate activates the worksheet 1.

Arr = range ("A 10 ")。 "Current Area" assigns a value to arr, and assigns a number in the range of A 10 to the ARR array.

Brr = sheet2。 Range ("a 1"). The brr allocation of the current area is the same as arr.

For i = 2 to UBound(arr)' loops according to the size of the arr array.

D(arr(i, 7)) = i+9' assigns a value to the D dictionary, and the key of D is the array arr(i, 7) with the value of i+9.

then

The loop from For i = 2 to UBound(brr)' depends on the size of the brr array.

If D. exists (BRR (I, 7)), then it will do (d (BRR (I, 7)). Copysheet2.cells (I, 1)' If the key of D dictionary already exists,

Then copy the row (dictionary key) of sheet 1 into the cell of Sheet2. Cell (i, 1).

then

End joint