- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 254
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-23
|
¦^´_ 1# wsx24680
¤£ª¾¬O¤£¬O³oÓ·N«ä- Sub Ex_1() 'Sheet2¸òSheet3¬Û¥[
- Dim A As Range
- Set d = CreateObject("Scripting.Dictionary")
- d("Item") = Array("ITEM", "NO.", "COUNT")
- For Each Sh In Sheets(Array("Sheet2", "Sheet3"))
- With Sh
- For Each A In .Range(.[A2], .[A65536].End(xlUp))
- If IsEmpty(d(A & A.Offset(, 1))) Then
- d(A & A.Offset(, 1)) = Array(A, A.Offset(, 1), A.Offset(, 2))
- Else
- ar = d(A & A.Offset(, 1))
- ar(2) = ar(2) + A.Offset(, 2)
- d(A & A.Offset(, 1)) = ar
- End If
- Next
- End With
- Next
- With Sheet3.[F1].Resize(d.Count, 3)
- .Value = Application.Transpose(Application.Transpose(d.items))
- .Sort key1:=.Cells(1, 1), Header:=xlYes
- End With
- End Sub
- Sub Ex_2() 'Sheet1p¼Æ
- Dim A As Range
- Set d = CreateObject("Scripting.Dictionary")
- With Sheet1
- d("Item") = Array("ITEM", "NO.", "COUNT")
- For Each A In .Range(.[A2], .[A65536].End(xlUp))
- If IsEmpty(d(A & A.Offset(, 1))) Then
- d(A & A.Offset(, 1)) = Array(A, A.Offset(, 1), 1)
- Else
- ar = d(A & A.Offset(, 1))
- ar(2) = ar(2) + 1
- d(A & A.Offset(, 1)) = ar
- End If
- Next
- End With
- With Sheet1.[F1].Resize(d.Count, 3)
- .Value = Application.Transpose(Application.Transpose(d.items))
- .Sort key1:=.Cells(1, 1), key2:=.Cells(1, 2), Header:=xlYes
- End With
- End Sub
½Æ»s¥N½X |
|