ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] °}¦C¾Þ§@½Ð¯q

[µo°Ý] °}¦C¾Þ§@½Ð¯q

½Ð°Ý¦U¦ì¤j¤j

³Ìªñ¤p§Ì¶i¦æ°}¦C¤Î¤U©Ô¦¡¿ï³æªº¹B¥Î

¤Wºôª¦¤å§ä¤èªk

ÁöµM¥i¥H¥¿±`¹B¦æ

¦ý¬O¤£À´³¡¤Àµ{¦¡ªº¾Þ§@¤è¦¡

²­nµ{¦¡½X¦p¤U
  1. Sub test()

  2.     '³]©w°}¦C½d³ò¤º®e
  3.     Arr = Range("A1:A10")

  4.     Set D = CreateObject("Scripting.Dictionary")

  5.     Dim aList$

  6.     For i = 1 To UBound(Arr)
  7.         D(Arr(i, 1)) = ""
  8.     Next

  9.     k = D.keys
  10.    
  11.     aList = Join(k, ",")

  12.     '«Ø¥ß¤U©Ô¿ï³æ
  13.     With Target.Validation
  14.         .Delete
  15.         .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
  16.         Operator:=xlBetween, Formula1:=aList

  17.     End With

  18. End Sub
½Æ»s¥N½X
½Ð°Ý¨ä¤¤ªº

D(Arr(i, 1)) = ""

k = D.keys

§Ú¤£À´³o¨â³¡¤Àªº¹B§@¤è¦¡

·Ð½Ð¸Ñ´b

ÁÂÁ¡I
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

¦^´_ 1# li_hsien
°Ñ¦Ò¬Ý¬Ý!!!
1. D(Arr(i, 1)) = ""
»yªk object.Item(key) [= newitem]   '¥i Ū¨ú/¼g¤J ÄÝ©Ê¡C
.item¬Ù²¤±¼¤F
¦b¼g¤J¤è­±¡A³o­Ó»P D.add ªº¤èªk«Ü¹³¡A¤£¤@¼Ëªº¬O add ¹J¨ì²K¥[­«½Æªº key­È ·|¦^À³¤@­Ó¿ù»~¡A
¦Óobject.Item(key) [= newitem] ·|¨ú¥N ¥ý«e¥[¤Jªº key­È ªº item­È

2. k = D.keys
¥Î kÅܼƶǦ^¤@­Ó°}¦C¡A¸Ó°}¦C¥]§t¤@­Ó Dictionary ª«¥ó¤¤ªº¥þ³¡ªºkey­È¡C
k¥u¯à«Å§i¦¨¤£©wÅܼƩΤ£©w°}¦C

TOP

¦^´_ 2# no3-taco

·PÁÂno3-taco

½Ð°ÝÃö©ó²Ä¤@ÂI¦³¨ÇºÃ´b

1. D(Arr(i, 1)) = ""
»yªk object.Item(key) [= newitem]   '¥i Ū¨ú/¼g¤J ÄÝ©Ê¡C
¨Ì±zªº·N«ä¬O¦b¶]°j°é®É¦pªG¸I¨ì¬Û¦Pªº­È·|¦Û°ÊÂл\§a???

¦ý½Ð°Ý«á­±ªº =newitem
¬°¤°»ò¬O =ªÅ­È ???
¤£¤ÓÀ´³o¤è¦¡

½Ðno3-taco¤j¨ó§U

ÁÂÁ¡I
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¥»©«³Ì«á¥Ñ no3-taco ©ó 2015-8-10 21:41 ½s¿è

¦^´_ 3# li_hsien
'Á`¤§²K¥[ªºkeyªº¦WºÙ¤£¥i¯à·|¦³­«½Æ¡A¦ý¬Oitem¥i¥H¦³­«½Æ
¬°¤°»ò¬O =ªÅ­È ???

³o¤£¬O§A¦Û¤v¼gªºµ{¦¡¡A¬Ý§A­n§âitemªº­È®³¨Ó°µÔ£¥Î??¡A§Úı±oÀ³¸Ó¬Oitemªº­È¥Î¤£¨ì©Ò¥H³]ªÅ­È
  1. Sub ½m²ß()
  2. Dim D As Object
  3. Set D = CreateObject("Scripting.Dictionary")
  4.     D.Add "valkey1", "item1"
  5.     D.Add "valkey2", "item2"
  6.     D.Add "valkey3", "item3"
  7.    
  8.     D.Item("valkey3") = "item5"  'valkey3¤w¦³¡A¶µ¥Ø­È¤£¦P¨ú¥N¶µ¥Ø­È
  9.     'D.Add "valkey3", "item6"  '(¦Û¤v¶}±Ò´ú¸Õ)¤w¦³¬Û¦Pkey­È¡A·|¶Ç¦^¤@­Ó¿ù»~
  10.    
  11.     Debug.Print D.Item("valkey3")  '(Ū¨ú¥Îªk) object.Item(key) [= newitem]
  12.     Debug.Print D("valkey3")       '¦P¤W¤@¦C(Ū¨ú¥Îªk) object.Item(key) [= newitem]
  13.     Debug.Print
  14.     '========¨Ï¥Î°}¦C¦C¥X===
  15. '    arr = D.Keys
  16. '    arr2 = D.Items
  17. '    For i = LBound(arr) To UBound(arr)
  18. '        Debug.Print arr(i), arr2(i)
  19. '    Next i

  20. End Sub
½Æ»s¥N½X
¥i°Ñ¦Ò¬ÛÃö³sµ²¡G
http://forum.twbts.com/viewthread.php?tid=20&extra=page%3D1%26amp%3Bfilter%3Ddigest
http://www.excelpx.com/thread-145901-1-1.html

TOP

¦^´_ 3# li_hsien
newitem ªº¸àÄÀ¡G
Optional.
Used for Dictionary object only; no application for collections.
If provided, newitem is the new value associated with the specified key.
If key is not found when changing an item, a new key is created with the specified newitem.

TOP

¦^´_ 4# no3-taco

·PÁÂno3-tacoªººëÅP¸ÑªR

¦]¬°¬Oºô¸ô¤W§ì¨ú¨Ó­×¥¿«÷´ê¥X¨Óªº

©Ò¥H¦Û¤v¤£¬Æ¤F¸Ñ¡A¦]¦¹¨Ó³oÃä´M¨D¸ÑªR

±z¥Î³o­Ó½d¨Ò¡A¾ã­Ó¹B§@¬yµ{²M·¡³\¦h

·PÁ¨ó§U¡I
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¦^´_ 5# c_c_lai

·PÁÂc_c_lai¸ÑÄÀ

´N§Ú²z¸Ñ¤W

¥¦¥D­n»¡©ú¾A¥Î¦a¤è¥~

¥t¥~´N¬O»¡©ú¦p¤W­zno3-taco¸ÑÄÀªº¹B§@¼Ò¦¡§a¡H
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

        ÀR«ä¦Û¦b : ¹ï¤÷¥À­nª¾®¦¡A·P®¦¡B³ø®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD