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

[µo°Ý] °½Ãiªº®t²§??

[µo°Ý] °½Ãiªº®t²§??

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-10-27 08:13 ½s¿è

¦U¦ì«e½ú¦­¦w
¬Q¤Ñ¦b½×¾Â¾Ç²ß¦r¨åµo²{®t²§!
¥ýÁ¿¥Ø«e»{ª¾ªºµ²½×,½Ð¦U¦ì«e½ú«ü¥¿¨Ã«ü¾É!ÁÂÁÂ
¥ô¦ó«D Exists() ¤èªk¬d¸ß¦r¨åªº¨BÆJµ{§Ç¥i¯à·|Åܰʦr¨åªº¼Æ¶q??
1.¼Ð·Çªº Dictionary ª«¥ó¤¤·j´Mªº¯Á¤Þ Áä ­È
For i = 1 To 20
   If Y.Exists(i) Then

2.°½Ãiªº Dictionary ª«¥ó¤¤·j´Mªº¯Á¤Þ Áä ­È
For i = 1 To 20
   If Y(i) = "" Then

¤ß±o®t²§»¡©ú¦p¤U:
°½Ãiªº¤è¦¡
Sub TEST_Count_1()
Dim Y, i, x, j
Set Y = CreateObject("Scripting.Dictionary")
Y(1) = 1
MsgBox Y.Count
For i = 1 To 20
   If Y(i) = "" Then

   End If
Next
MsgBox Y.Count
For Each x In Y.KEYS
   j = j + 1
Next
MsgBox j
End Sub

µøµ¡·|Åã¥Ü 1  ¡÷  20  ¡÷  20
--------------------------------------------------
¼Ð·Çªº¤è¦¡
Sub TEST_Count_2()
Dim Y, i, x, j
Set Y = CreateObject("Scripting.Dictionary")
Y(1) = 1
MsgBox Y.Count
For i = 1 To 20
   If Y.Exists(i) Then

   End If
Next
MsgBox Y.Count
For Each x In Y.KEYS
   j = j + 1
Next
MsgBox j
End Sub

µøµ¡·|Åã¥Ü 1  ¡÷  1  ¡÷  1

¹Ï¤ù¥i¥H¤W¶Ç¤F!ÁÂÁ ¤p»x«e½ú
¸É¥R¹Ï¤ù
°½Ãiªº¬d¸ß¤è¦¡:






¼Ð·Çªº¬d¸ß¤è¦¡:




TOP

§âkey»Pitem Âà¸m¥X¨Ó°µÅçÃÒ


Option Explicit
Sub TEST_Count_3()
Dim Y, i, x, j
Set Y = CreateObject("Scripting.Dictionary")
Y(1) = 1
For i = 1 To 20
   If Y(i) = i Then

   End If
Next
Workbooks.Add
[A1].Resize(Y.Count, 1) = Application.Transpose(Y.KEYS)
[B1].Resize(Y.Count, 1) = Application.Transpose(Y.ITEMS)
End Sub

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD