- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# yliu
¸Õ¸Õ¬Ý- Option Explicit
- Sub EX_1() 'ªí1ªºµ{¦¡
- Dim q³æ¸¹½X As String, ½ÐÁʳ渹 As String, ½ÐÁʼt°Ó As String
- Dim AR(1 To 6), i As Integer
- With Sheets("report")
- q³æ¸¹½X = .[B5]
- ½ÐÁʳ渹 = .[D5]
- ½ÐÁʼt°Ó = .[B6]
- With Sheets("final")
- i = 2
- Do While .Cells(i, "A") <> ""
- If .Cells(i, "v").Value = q³æ¸¹½X And .Cells(i, "F") = ½ÐÁʳ渹 And .Cells(i, "L") = ½ÐÁʼt°Ó Then
- AR(1) = .Cells(i, "j") '«~¦W
- AR(2) = AR(2) & IIf(AR(2) = "", "", ",") & .Cells(i, "k") '³W®æ
- AR(3) = .Cells(i, "i") '·|p¬ì¥Ø
- AR(4) = .Cells(i, "b") '±ÄÁʩʽè
- AR(5) = AR(5) + .Cells(i, "m") 'User½ÐÁÊ»ù
- AR(6) = .Cells(i, "c") '±ÄÁÊÃþ§O
- End If
- i = i + 1
- Loop
- End With
- .[B7] = AR(1)
- .[B8] = AR(2)
- .[B9] = AR(3)
- .[D9] = AR(4)
- .[B10] = AR(5)
- .[D10] = AR(6)
- End With
- End Sub
- Sub EX_2() 'ªí1ªºµ{¦¡
- Dim d As Object, KEY, i As Integer, AR(), A(1 To 4), q³æ¸¹½X As String
- Set d = CreateObject("SCRIPTING.DICTIONARY") '¦r¨åª«¥ó Scripting.Dictionary
- q³æ¸¹½X = Sheets("report").[B5]
- With Sheets("record")
- .AutoFilterMode = False '¨ú®ø ¤u§@ªíªº¦Û°Ê¿z¿ï
- i = 2
- Do While .Cells(i, "A") <> ""
- If .Cells(i, "P").Value = q³æ¸¹½X Then '¤ñ¹ï q³æ¸¹½X
- If d.exists(.Cells(i, "C").Value) = False Then d(.Cells(i, "C").Value) = .Cells(i, "C")
- End If
- i = i + 1
- Loop
- ReDim AR(1 To d.Count) '«¸m°}¦Cªº¤¸¯À¤W=¦r¨åª«¥óªºp¼Æ(Count)
- .Range("A1").AutoFilter 16, q³æ¸¹½X 'AutoFilter ¦Û°Ê¿z¿ï ²Ä16Äæ «ü©w±ø¥óÈ=q³æ¸¹½X
- i = 1
- For Each KEY In d.KEYS
- .Range("A1").AutoFilter 3, KEY 'AutoFilter ¦Û°Ê¿z¿ï ²Ä3Äæ «ü©w±ø¥óÈ=¦r¨åª«¥óªºKEY
- A(1) = KEY '±ÄÁʼt°Ó
- A(2) = Application.Sum(.Range("M:M").SpecialCells(xlCellTypeVisible)) '²Ä1¦¸Ä³»ù
- A(3) = Application.Sum(.Range("N:N").SpecialCells(xlCellTypeVisible)) '²Ä2¦¸Ä³»ù
- A(4) = Application.Sum(.Range("O:O").SpecialCells(xlCellTypeVisible)) '²Ä3¦¸Ä³»ù
- AR(i) = A
- i = i + 1
- Next
- End With
- Sheets("report").[B13].Resize(4, 3) = Application.WorksheetFunction.Transpose(AR) '¾É¤J
- End Sub
½Æ»s¥N½X |
|