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

[µo°Ý] vlookup³t«×ºC¡A¨Ï¥Îvba¨ú¥Nªºµ{¦¡½X

¦^´_ 5# GBKEE

®M¥Î¤F§Aªºµ{¦¡½X, ¦ý¬O³t«×º¡ºCªº, ¤£ª¾¹D°ÝÃD¥X¦b¨º¨½?
¥i§_½ÐG¤jÀ°§Ú¬Ý¬Ý..
ÁÂÁÂ!!

Dictionary.rar (850.66 KB)

TOP

¦^´_ 1# chiang0320

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. 'Option Explicit ¬° ¦b¼Ò²Õ¼h¦¸¤¤±j­¢¨C­Ó¦b¼Ò²ÕùتºÅܼƳ£¥²¶·©ú½Tªº«Å§i¡C
  3. '³o¬O½s¼gµ{¦¡©ö©ó°»¿ùªº¦n²ßºD
  4. Sub Ex()
  5.     Dim d As Object, E As Range, Ar(), T As Date
  6.     T = Time
  7.     Debug.Print "µ{¦¡¶}©l®É¶¡ : " & T   '«ü¥O->À˵ø->§Y®É¹Bºâµøµ¡ :  ¬d¬Ýµ{¦¡°_©l®É¶¡
  8.     'Dim i%= i As Integer
  9.     'Integer ¸ê®Æ«¬ºA Integer ÅܼƫY¥H½d³ò¬° -32,768 ¨ì 32,767 ¤§ 16 ¦ì¤¸ (2 ­Ó¦ì¤¸²Õ) ¼Æ¦rªº§Î¦¡Àx¦s¡CInteger ªº«¬ºA«Å§i¦r¤¸¬O¦Ê¤À¤ñ²Å¸¹(%
  10.     '********** ¤£·|·¸¦ì  ***********
  11.     Dim i As Long  '= i&
  12.     'Long ¸ê®Æ«¬ºA
  13.     'Long (ªø¾ã¼Æ)ÅܼƫY¥H½d³ò±q -2,147,483,648 ¨ì 2,147,483,647 ¤§ 32 ¦ì¤¸ (4 ­Ó¦ì¤¸²Õ) ¦³¸¹¼Æ¦r§Î¦¡Àx¦s¡CLong ªº«¬ºA«Å§i¦r¤¸¬° &¡C '

  14.     Set d = CreateObject("scripting.dictionary")  '¦r¨åª«¥ó
  15.     With Sheets("p10")
  16.         For Each E In .Range(.[a1], .[a1].End(xlDown))
  17.             d(E.Value) = Array(E.Offset(, 2), E.Offset(, 3))
  18.             'e.Value > ¦r¨åª«¥óªºÃöÁä¦r(key) ¾É¤J Array(e.Offset(, 2), e.Offset(, 3))
  19.         Next
  20.     End With
  21.     With Sheets("q72").Range(Sheets("q72").[B2], Sheets("q72").[B2].End(xlDown)).Resize(, 4)
  22.         Ar = .Value
  23.         For i = 1 To UBound(Ar)
  24.             If d.exists(Ar(i, 1)) Then
  25.             'Exists ¤èªk ¦pªG¦b Dictionary ª«¥ó¤¤«ü©wªºÃöÁä¦r¦s¦b¡A¶Ç¦^ True¡A­Y¤£¦s¦b¡A¶Ç¦^ False¡C
  26.                 Ar(i, 3) = d(Ar(i, 1))(0)
  27.                 Ar(i, 4) = d(Ar(i, 1))(1)
  28.             Else
  29.                 Ar(i, 3) = "µL¸ê®Æ"
  30.                 Ar(i, 4) = "µL¸ê®Æ"
  31.             End If
  32.         Next
  33.         .Value = Ar
  34.     End With
  35.     Debug.Print "µ{¦¡µ²§ô®É¶¡ : " & Time, Application.Text(Time - T, "¦@­p[S]¬í")
  36.     '«ü¥O->À˵ø->§Y®É¹Bºâµøµ¡ :  ¬d¬Ýµ{¦¡¹B¦æ³t«×
  37. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

§ó§ï dim i %, r% ¬° dim i as Variant, r as Variant

TOP

¦^´_ 2# ikboy

ikboy §A¦n:

½Ð°Ý¬Oª½±µ¥[¤J³o¥yµ{¦¡½X¶Ü?

TOP

try
dim i as Variant, r as Variant

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD