Scripting.DictionaryªºÀ³¥Î
- ©«¤l
- 178
- ¥DÃD
- 65
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2010-5-4
- ³Ì«áµn¿ý
- 2024-2-1
|
Scripting.DictionaryªºÀ³¥Î
³o¨â¤Ñ¦b¬Ý¦r¨åªºÀ³¥Î,¦r¨å¹ï¶Hªº¤èªk¦³6Ó¡GAdd¤èªk¡BKeys¤èªk¡BItems¤èªk¡BExists¤èªk¡BRemove¤èªk¡BRemoveAll¤èªk¡C
ªþ¥ó¤@Ótest filr ·Q¬Ý¬Ý¦Ñ®v«ç¼g?©M¥Î¨ì¤W±ªºþ´XÓ¤èªk
|
-
-
Â^¨ú2.PNG
(19.01 KB)
-
-
TEST2.zip
(8.17 KB)
|
|
|
|
|
|
- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
¸ê®Æªí:
µ²ªGªí°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST_1()
Dim Brr, Crr, Z, i&, j%, R&, Y&, T$
Set Z = CreateObject("Scripting.Dictionary")
Brr = Range([¤u§@ªí1!D1], [¤u§@ªí1!A65536].End(3))
ReDim Crr(1 To UBound(Brr), 1 To 3)
For i = 1 To UBound(Brr)
T = Brr(i, 2) & "|" & Brr(i, 4)
R = Z(T)
If R = 0 Then
Y = Y + 1: R = Y
For j = 1 To 3: Crr(R, j) = Brr(i, j + 1): Next
Z(T) = R: GoTo i01
End If
Crr(R, 2) = Crr(R, 2) + Brr(i, 3)
i01: Next
With [Summary!A1].Resize(Y, 3)
.EntireColumn.ClearContents
.Value = Crr
End With
Set Z = Nothing: Erase Brr, Crr
End Sub |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤l
- 178
- ¥DÃD
- 65
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2010-5-4
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 10# samwang
ÁÂÁ±z¸ÑÄÀ. |
|
|
|
|
|
|
- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
¦^´_ 9# john2006168
¸ÑÄÀ¼g±o¤£¦n®É¡A½Ð¨£½Ì¡A·PÁ¡C
Sub test()
Dim Arr, xD, T, T2, T3, T4, i&, M%, N%
Set xD = CreateObject("Scripting.Dictionary")
Arr = Sheets("¤u§@ªí1").[A1].CurrentRegion '¸ê®Æ¸Ë¤J¼Æ²Õ
For i = 1 To UBound(Arr)
T = Arr(i, 2) & "|" & Arr(i, 4) 'ÃöÁä±ø¥ó¦ê³s¤@°_·í§@key
T2 = Arr(i, 2): T3 = Arr(i, 3): T4 = Arr(i, 4)
If xD.Exists(T & "") Then 'key¦³µL¦b¦r¨å
M = xD(T & "") '§ä¨ì¦Pkeyªº¦ì¸m
Arr(M, 2) = Arr(M, 2) + T3 '²Ö¥[
Else
N = N + 1: xD(T & "") = N 'key¸Ë¤J¦r¨å¥B½s¬y¤ô¸¹
Arr(N, 1) = T2: Arr(N, 2) = T3: Arr(N, 3) = T4 '±N²Å¦X±ø¥óªº¸ê®Æ¸Ë¨ìµ²ªGªº¼Æ²Õ
End If
Next
Sheets("Summary").[A1].Resize(N, 3) = Arr 'µ²ªGÅã¥Ü
End Sub |
|
|
|
|
|
|
- ©«¤l
- 178
- ¥DÃD
- 65
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2010-5-4
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 8# samwang
¥i¥H¹B¦æ,¦ý¬O¦³¨Ç¦a¤è¤£¬O«Ü²z¸Ñ,¥i§_À°¦£µùÄÀ¤@¤U. |
|
|
|
|
|
|
- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
¦^´_ 7# john2006168
½Ð´ú¸Õ¬Ý¬Ý¡A±ø¥ó½ÆÂø®É¡A¥i¥H¨Ï¥Î¦r¨å+¼Æ²Õ°}¦C¤ñ¸û®e©ö¸Ñ¡AÁÂÁ¡C
Sub test()
Dim Arr, xD, T, T2, T3, T4, i&, M%, N%
Set xD = CreateObject("Scripting.Dictionary")
Arr = Sheets("¤u§@ªí1").[A1].CurrentRegion
For i = 1 To UBound(Arr)
T = Arr(i, 2) & "|" & Arr(i, 4)
T2 = Arr(i, 2): T3 = Arr(i, 3): T4 = Arr(i, 4)
If xD.Exists(T & "") Then
M = xD(T & ""): Arr(M, 2) = Arr(M, 2) + T3
Else
N = N + 1: xD(T & "") = N
Arr(N, 1) = T2: Arr(N, 2) = T3: Arr(N, 3) = T4
End If
Next
Sheets("Summary").[A1].Resize(N, 3) = Arr
End Sub |
|
|
|
|
|
|
- ©«¤l
- 178
- ¥DÃD
- 65
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2010-5-4
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 6# samwang
samwang,½Ð°Ý¤@¤U¦pªG§Ú¥[¦h¤@Äæ©M¦h¤@Ó±ø¥ó,¬Û¦Pªº"LOCATION"¥[¦b¤@°_,½Ð°Ý³o¼Ë«ç»ò¼g. |
-
-
Â^¨ú.PNG
(7.86 KB)
-
-
TEST2.zip
(12.73 KB)
|
|
|
|
|
|
- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
¦^´_ 5# john2006168
¤£¦n·N«ä4¼Ó¡AT3¶·§ï¬°T2
xD(T & "") = xD(T & "") + T2 ' Name¦³«½Æ®É¡AOder ¼ÆȲ֥[ |
|
|
|
|
|
|
- ©«¤l
- 178
- ¥DÃD
- 65
- ºëµØ
- 0
- ¿n¤À
- 252
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2010-5-4
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 3# samwang
ÁÂÁ´£¨Ñ¨âºØ¤èªk,ºCºC¾Ç²ß¤¤.
½Ð°Ý¥i§_À°¦£¸ÑÄÀ³o¥y·N«ä?
xD(T & "") = xD(T & "") + T2 |
|
|
|
|
|
|
- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
§ó·s#3¼Ó¡A©ñ¤F±NªíÀY²Ä¤@¦C¤]¥i¥H¼g¤J¦r¨å§Y¥i¡AÁÂÁ¡C
Sub test3()
Dim Arr, xD, T, T2, i&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Sheets("¤u§@ªí1").[A1].CurrentRegion
For i = 1 To UBound(Arr)
T = Arr(i, 2): T2 = Arr(i, 3)
xD(T & "") = xD(T & "")
xD(T & "") = xD(T & "") + T3
Next
Sheets("Summary").[A1].Resize(xD.Count) = Application.Transpose(xD.keys)
Sheets("Summary").[B1].Resize(xD.Count) = Application.Transpose(xD.items)
End Sub |
|
|
|
|
|
|