- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 4# Haven - Sub Test()
- Dim ar, dMachines As Object, dTemp As Object
- ar = [a1].CurrentRegion.Value
- Set dMachines = CreateObject("scripting.dictionary")
- Set dBelong = CreateObject("scripting.dictionary")
- For i = 2 To UBound(ar)
- If Not dMachines.exists(ar(i, 3)) Then
- Set dTemp = CreateObject("scripting.dictionary")
- dMachines.Add ar(i, 3), dTemp
- Else
- Set dTemp = dMachines(ar(i, 3))
- End If
- dTemp(ar(i, 2)) = dTemp(ar(i, 2)) + 1
- dBelong(ar(i, 3)) = ar(i, 1)
- Next
-
- Dim s As String, cnt As Integer
- For Each x In dMachines.keys
- s = "": cnt = 0
- Set dTemp = dMachines(x)
- For Each y In dTemp.keys
- s = s & IIf(Len(s) = 0, "", ",") & y & "*" & dTemp(y)
- cnt = cnt + dTemp(y)
- Next
- dMachines(x) = Array(x, s, dBelong(x) & "³]³Æ²§±`", cnt)
- Next
-
- 'Output
- With Sheets.Add
- cnt = dMachines.Count
- With .[a1]
- .Cells(1, 2).Resize(cnt, 4) = Application.Transpose(Application.Transpose(dMachines.items))
- .Resize(cnt, 5).Sort .Cells(1, 5), xlDescending ', , .Cells(1, 2), xlAscending
- .Cells(1, 5).EntireColumn.ClearContents
- If cnt > 10 Then
- .Offset(10).Resize(cnt - 10, 4).ClearContents
- cnt = 10
- End If
- .Value = Format(Now(), "m¤ëd¤é")
- .Resize(cnt).Merge
- End With
- End With
- End Sub
½Æ»s¥N½X |
|