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

°}¦C»P¦r¨å

°}¦C»P¦r¨å

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«±N³o°}¤l¾Ç¨ìªº°}¦C»P¦r¨å¤ß±o¥Î°ê»y¦r¨å¤ñ³ë,½Ð¦U¦ì«e½ú«ü±Ð,½Ð¦U¦ì«á¾Ç¤@°_¾Ç²ß

Option Explicit
Sub °ê»y¦r¨å()
Dim xD, Arr, Brr
Set xD = CreateObject("Scripting.Dictionary")
xD("¦Y") = "©CÄZ­¹ª««á§]¤U"
'¡ô¦r¦ê"¦Y"¬Okey ,¦r¦ê"©CÄZ­¹ª««á§]¤U"¬OItem
xD("³Ü") = "§l¶¼"
'¡ô¦r¦ê"³Ü"¬Okey ,¦r¦ê"§l¶¼"¬OItem
xD("ª±") = "¹CÀ¸"
'¡ô¦r¦ê"ª±"¬Okey ,¦r¦ê"¹CÀ¸"¬OItem
xD("¼Ö") = "³ß®®"
'¡ô¦r¦ê"¼Ö"¬Okey ,¦r¦ê"³ß®®"¬OItem
Arr = xD.keys
'¡ô(¦r¨åKeys¥»¨­´N¬O°}¦C) ,¦P¸q Arr = Array("¦Y", "³Ü", "ª±", "¼Ö")
Brr = xD.Items
'¡ô(¦r¨åItems¥»¨­¤]¬O°}¦C),
'¦P¸q Brr = Array("©CÄZ­¹ª««á§]¤U", "§l¶¼", "¹CÀ¸", "³ß®®")


'³o¦r¨å¸Ì¦³4­Ó°ê¦r(keys) ¤Î³o4­Ó°ê¦rªº¸ÑÄÀ(items)
MsgBox xD("¦Y")
MsgBox xD("³Ü")
MsgBox xD("ª±")
MsgBox xD("¼Ö")
MsgBox Arr(0)
MsgBox Arr(1)
MsgBox Arr(2)
MsgBox Arr(3)
MsgBox Brr(0)
MsgBox Brr(1)
MsgBox Brr(2)
MsgBox Brr(3)
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-13 09:58 ½s¿è

'·í«á¤èªºµ{§Ç¤£»Ý­n¥Î¨ìitem­È®É,´NÀH·Nµ¹­Ó¦r¤¸(""ªÅ¦r¤¸¬O³Ì±`¥Îªº)
'´N¹³§Q¥Î¦r¨åªºkey¨ÓÂo±¼­«½Æªº­È³Ì±`¥Î¨Ó¨ú¥N²©öªº ¶i¶¥¿z¿ï
Option Explicit
Sub °ê»y¦r¨å_ªÅ¦r¤¸ªºitem()
Dim xD, Arr, Brr
Set xD = CreateObject("Scripting.Dictionary")
xD("¦Y") = ""
'¡ô¦r¦ê"¦Y"¬Okey ,¦r¦ê""¬OItem
xD("³Ü") = ""
'¡ô¦r¦ê"³Ü"¬Okey ,¦r¦ê""¬OItem
xD("ª±") = ""
'¡ô¦r¦ê"ª±"¬Okey ,¦r¦ê""¬OItem
xD("¼Ö") = ""
'¡ô¦r¦ê"¼Ö"¬Okey ,¦r¦ê""¬OItem
Arr = xD.keys
'¡ô(¦r¨åKeys¥»¨­´N¬O°}¦C) ,¦P¸q Arr = Array("¦Y", "³Ü", "ª±", "¼Ö")
Brr = xD.Items
'¡ô(¦r¨åItems¥»¨­¤]¬O°}¦C),
'¦P¸q Brr = Array("", "", "", "")


'³o¦r¨å¸Ì¦³4­Ó°ê¦r(keys) ¤Î³o4­Ó°ê¦rªº¸ÑÄÀ(items(ªÅ¦r¤¸))
MsgBox xD("¦Y")
MsgBox xD("³Ü")
MsgBox xD("ª±")
MsgBox xD("¼Ö")
MsgBox Arr(0)
MsgBox Arr(1)
MsgBox Arr(2)
MsgBox Arr(3)
MsgBox Brr(0)
MsgBox Brr(1)
MsgBox Brr(2)
MsgBox Brr(3)
xD("¦Y") = "©CÄZ­¹ª««á§]¤U"
'³o®É¦r¨å¸Ì¤@¼Ë¦³4­Ó°ê¦r(keys) ¤Î³o4­Ó°ê¦rªº¸ÑÄÀ(items)
'¤£¤@¼Ëªº¬O keys¸Ìªº"¦Y"¹ïÀ³ªºitem¥Ñ("")Åܦ¨¤F "©CÄZ­¹ª««á§]¤U"

MsgBox xD("¦Y")
Arr = xD.keys
'keys¸Ìªº"¦Y"¤@¼Ë±Æ¦b­º¦ì
Brr = xD.Items
MsgBox Arr(0)
MsgBox Brr(0)
'³oµ{§Ç¸Ì¯Ç¤J¹L5¦¸¦r¤¸¨ìxD¦r¨åªºkeys¸Ì,¦ý¬Okey¤£·|­«½Æ
'¯Ç¤J¹L5¦¸¦r¤¸ : "¦Y", "³Ü", "ª±", "¼Ö", "¦Y"
'³Ì²×¥u¦³³o4­Ó "¦Y", "³Ü", "ª±", "¼Ö"

'¬JµM«á¤èªºµ{§Ç¤£»Ý­n¥Î¨ìitem,´NÀH·Nµ¹­Ó""(ªÅ¦r¤¸)§a!
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-13 10:23 ½s¿è

Option Explicit
Sub ¤£­nÀH·N°²³]()
Dim xD, Arr, Brr
Set xD = CreateObject("Scripting.Dictionary")
If xD("¦Y") = "©CÄZ­¹ª««á§]¤U" Then MsgBox "¤£¥i¯à"
If xD("³Ü") = "§l¶¼" Then MsgBox "¤£¥i¯à"
If xD("ª±") = "¹CÀ¸" Then MsgBox "¤£¥i¯à"
If xD("¼Ö") = "³ß®®" Then MsgBox "¤£¥i¯à"
Arr = xD.keys
Brr = xD.Items
MsgBox Arr(0)
MsgBox Arr(1)
MsgBox Arr(2)
MsgBox Arr(3)
MsgBox Brr(0)
MsgBox Brr(1)
MsgBox Brr(2)
MsgBox Brr(3)
MsgBox xD.Count
'³o­Ó½d¨Ò¸Ì¨Ì¥H©¹»{ª¾¦r¨å¸ÌÀ³¸ÓÁÙ¨S¦³key
MsgBox xD("¶Ô")
MsgBox xD.Count
End Sub
'=====================================
Option Explicit
Sub ²©ö°j°é«Ø¥ß¦r¨å()
Dim xD, Arr, Brr, i&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Array("¦Y", "³Ü", "ª±", "¼Ö")
Brr = Array("©CÄZ­¹ª««á§]¤U", "§l¶¼", "¹CÀ¸", "³ß®®")
For i = 0 To UBound(Arr)
   xD(Arr(i)) = Brr(i)
Next
MsgBox xD("¦Y")
MsgBox xD("³Ü")
MsgBox xD("ª±")
MsgBox xD("¼Ö")
MsgBox xD.Count
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ mdr0465 ©ó 2023-4-13 12:47 ½s¿è

¦^´_ 3# Andy2483


§Ú¤w¸g¯d·N¤F«Ü¤[,Andy©M¦U¦ì«e½úªº¸g±`¦b½×¾ÂÀ°§U¦U¦ì¾Ç­ûªº¨D§U,

¦]«á¾Ç·M¬N,¾Ç¤F¦h®É³£¥¼¯à´x´¤·í¤¤ªºÀ³¥Î,²{¦bAndy «e½ú¼Ö·NµL¨p¤À¨É°}¦C»P¦r¨åªºÀ³¥Î©M±Ð¾Ç, «á¾Ç¸U¤À·P¿E

Àµ½ÐAndy «e½ú¤£©w®É¤W¸ü¦h¤@ÂI¹ê¨Ò©M±Ð¾Ç,¥O«á¾Ç§ó¥[²z¸Ñ°}¦C»P¦r¨åªº¹B¥Î, «á¾ÇµL¥H¬°³ø, ¸U¤À·P¿E©M¤ä«ù:handshake

TOP

¦^´_ 4# mdr0465


    ÁÂÁ«e½ú¦^´_,ÁÂÁ½׾Â
«á¾Ç¤À¨É­è¾ã²zªº¥H¤U¤ß±o,½Ð«e½ú­Ì«ü±Ð,½Ð«á¾Ç­Ì±`¤W½×¾ÂµoªíÆ[ÂI»P¤ß±o

Option Explicit
Sub Item¤¤ªº°}¦C()
Dim xD, Arr, Brr, i&
'¡ô«Å§iÅܼÆ:(xD,Arr,Brr)¬O³q¥Î«¬ÅܼÆ,i¬Oªø¾ã¼Æ
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxD³o³q¥Î«¬ÅܼƬO ¦r¨å
Arr = Array("¦Y", "³Ü", "ª±", "¼Ö")
'¡ô¥OArr³o³q¥Î«¬ÅܼƬO ¤@ºû°}¦C,4­Ó¦r¦ê¤¸¯À,¯Á¤Þ¸¹0~3
Brr = Array("©CÄZ­¹ª««á§]¤U", "§l¶¼", "¹CÀ¸", "³ß®®")
'¡ô¥OBrr³o³q¥Î«¬ÅܼƬO ¤@ºû°}¦C,4­Ó¦r¦ê¤¸¯À,¯Á¤Þ¸¹0~3
xD("°ê¦r") = Arr
'¡ô¥O"°ê¦r"¦r¦ê·íkey,item¬OArr¤@ºû°}¦C
xD("°ê¦r¸ÑÄÀ") = Brr
'¡ô¥O"°ê¦r¸ÑÄÀ"¦r¦ê·íkey,item¬OBrr¤@ºû°}¦C
For i = 0 To UBound(xD("°ê¦r"))
'¡ô³]°j°é!i±q0¨ì xD("°ê¦r")³o¤@ºû°}¦Cªº³Ì«á¯Á¤Þ¸¹
   MsgBox xD("°ê¦r")(i) & " = " & xD("°ê¦r¸ÑÄÀ")(i)
   '¡ô¥O¸õ¥X´£¥Üµ¡
Next
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 5# Andy2483
Andy«e½úªº¥Î¤ßµ{«×Åý¤HÆg¹Ä¡A¤µ¤é¬Ý¨ì¸Ó½d¨Ò¤~¹ï¦r¨å³o¶ô¦³¤Fªì¨Bªº²z¸Ñ..
¸U¤À·PÁÂ!!

TOP

¦^´_ 6# shuo1125


    ÁÂÁ«e½ú¦^´_
±`¤W½×¾Â¤@°_¾Ç²ß
«á¾Ç¦­¤W¾ã²z¤F¤@¤U¤ß±o,½Ð«e½ú°Ñ¦Ò,½Ð¦U¦ì«e½ú«ü±Ð

Option Explicit
Sub ¦r¨å¼g¤JÀx¦s®æ¸Ì()
Dim xD, Arr, Brr
Set xD = CreateObject("Scripting.Dictionary")
xD("¦Y") = "©CÄZ­¹ª««á§]¤U"
xD("³Ü") = "§l¶¼"
xD("ª±") = "¹CÀ¸"
xD("¼Ö") = "³ß®®"
'¦r¨åkeys¥»¨­´N¬O°}¦C,¬O¤@ºû°}¦C,¥Ñ¥ª¦Ü¥kÂ\©ñ
Workbooks.Add
'¡ô¥O·s¼W¤@­Ó¬¡­¶Ã¯
[A1].Resize(1, xD.Count) = xD.keys
'¡ô¥O·s¼W¬¡­¶Ã¯²Ä1­Ó¤u§@ªí[A1]Àx¦s®æ,ÂX®i¦V¥k(xD¦r¨åkey¼Æ¶q)Äæ¼Æ,
'¦¹½d³òÀx¦s®æ­È¥HxD¦r¨åªº©Ò¦³key±a¤J

[A2].Resize(1, xD.Count) = xD.items
'¡ô¥O[A2]Àx¦s®æ,ÂX®i¦V¥k(xD¦r¨åkey¼Æ¶q)Äæ¼Æ,
'¦¹½d³òÀx¦s®æ­È¥HxD¦r¨åªº©Ò¦³item±a¤J

End Sub

°õ¦æµ²ªG:
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

°¶¤jªºANDY¤j¤j
À°§U½×¾Â«Ü¦h¤H

TOP

¦^´_ 8# coafort


    ÁÂÁ«e½ú¦^´_,¤@°_¾Ç²ß
«á¾ÇÂǦ¹©«¾ã²z¤ß±o,½Ð«e½ú­Ì«ü±Ð

°õ¦æµ²ªG:


Option Explicit
Sub ¦r¨å_Áa¦V¼g¤JÀx¦s®æ¸Ì()
Dim xD, Arr, Brr
Set xD = CreateObject("Scripting.Dictionary")
xD("¦Y") = "©CÄZ­¹ª««á§]¤U"
xD("³Ü") = "§l¶¼"
xD("ª±") = "¹CÀ¸"
xD("¼Ö") = "³ß®®"
'¦r¨åkeys¥»¨­´N¬O°}¦C,¬O¤@ºû°}¦C,¥Ñ¥ª¦Ü¥kÂ\©ñ
Workbooks.Add
'¡ô¥O·s¼W¤@­Ó¬¡­¶Ã¯
[A1].Resize(xD.Count, 1) = Application.Transpose(xD.keys)
'¡ô¥O·s¼W¬¡­¶Ã¯²Ä1­Ó¤u§@ªí[A1]Àx¦s®æ,ÂX®i¦V¤U(xD¦r¨åkey¼Æ¶q)¦C¼Æ,
'¦¹½d³òÀx¦s®æ­È¥HxD¦r¨åªº©Ò¦³keyÂà¸m±a¤J

[B1].Resize(xD.Count, 1) = Application.Transpose(xD.items)
'¡ô¥O[B1]Àx¦s®æ,ÂX®i¦V¥k(xD¦r¨åkey¼Æ¶q)¦C¼Æ,
'¦¹½d³òÀx¦s®æ­È¥HxD¦r¨åªº©Ò¦³itemÂà¸m±a¤J

End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

ÁÂÁÂANDY¤jªº¤å¦r»¡©ú, À°§U½×¾Â¤H§ó®e©ö²z¸Ñ»P¾Ç²ß, ·PÁ !

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD