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

½Ð±Ð ¤½¦¡_¸õÄæ¨Ã¥B²Å¦X±ø¥ó¤~¥[Á`

¦^´_ 25# ­ã´£³¡ªL


    ½Ð±Ð«e½ú Ãö©ó SET °ÝÃD
¤U¤èµ{¦¡½X ¥[¤FSET ¤§«á°õ¦æ®É¶¡¬O¨S¥[SETªº3­¿
Set Z = Z(1, 1).Resize(R, W)     '0.09¬í
Z = Z(1, 1).Resize(R, W)            '0.03¬í

1.¬O¦]¬°¨S¥[SET¬O°}¦C,¥[¤FSET ¬O¦r¨å¶Ü?
2.¤°»ò®É­Ô¥Î °}¦C?¤°»ò®É­Ô¥Î ¦r¨å?

ÁÂÁ«e½ú
  1. Option Explicit
  2. Sub TEST_20220920_2()
  3. Dim Brr, R&, C&, i&, j&, k%, T$, TT, Y, Z, W
  4. TT = Timer
  5. Set Y = CreateObject("Scripting.Dictionary")
  6. Set Z = CreateObject("Scripting.Dictionary")
  7. Set Z = ActiveSheet.Cells
  8. R = Z(Rows.Count, "D").End(xlUp).Row '³Ì«á¤@¦æ
  9. W = Z(12, Columns.Count).End(xlToLeft).Column '³Ì«á¤@Äæ
  10. Set Z = Z(1, 1).Resize(R, W) '©w¸q¸ê®Æ½d³ò--A1¦Ü¾ã­Ó°Ï
  11. For i = 1 To 13 Step 4
  12.    Y.Add Mid(Z(11, i + 12), 2, 2), i
  13. Next
  14. ReDim Brr(1 To R - 12, 1 To 20) '³]ªÅ°}¦C
  15. For i = 13 To R
  16.    For j = [AG1].Column To W Step 4
  17.        T = Right(Split(Z(11, j), "]")(0), 2)  '¨ú[??]¤¤ªº¤å¦r
  18.        C = Y(T) 'ÀË´ú¦U¤À¶µ­n¶ñ¤JBrrªº¦ì¸m
  19.        If C = 1 Then  '«e¸m--¨ú³Ì¤j
  20.           For k = 0 To 2
  21.               If Z(i, j + k) > Brr(i - 12, C + k) Then
  22.                  Brr(i - 12, C + k) = Z(i, j + k)
  23.               End If
  24.           Next k
  25.        ElseIf C >= 5 Then '¨ä¥¦¶µ--²Ö­p
  26.           For k = 0 To 2
  27.               Brr(i - 12, C + k) = Brr(i - 12, C + k) + Z(i, j + k) '¦U¤À¶µ²Ö­p
  28.               Brr(i - 12, 17 + k) = Brr(i - 12, 17 + k) + Z(i, j + k) '¦X­p
  29.           Next k
  30.        End If
  31.     Next j
  32. Next i
  33. [M13].Resize(UBound(Brr), UBound(Brr, 2)) = Brr
  34. MsgBox Timer - TT
  35. End Sub
½Æ»s¥N½X

TOP

VBA¤¤ªº°}¦C¥Îªk, ­n¦­ÂI¤F¸Ñ,
³Ì¦n¤]²z¸Ñ¦r¨å¥Îªk,
¦r¨å+°}¦C, ¥i³B²z«Ü¦hºØ¸ê®Æªº³B²z¤Î²Î­p¹Bºâ»Ý¨D,
...
­ã´£³¡ªL µoªí©ó 2020-8-24 17:19



    ÁÂÁ«e½ú«ü¾É
«á¾Ç¾q¶w! ¸g¹L¤F2¦~¤~¾Ç¨ì°}¦C»y¦r¨åªº¤@ÂIÂI¥Ö¤ò
¶Ô¯à¸É©å!,¥Ã¤£©ñ±ó!
¤U¦Cµ{¦¡½X¬O¤µ¤é¾Ç²ß¨ìªº¦r¨å»P°}¦C§Þ¥©
¦A½Ð«e½ú¼·ªÅ¦A«ü¾É
  1. Option Explicit
  2. Sub TEST_20220920_3()
  3. Dim Brr, R&, C&, i&, j&, k%, T$, TT, Y, Z, W, P, Q
  4. Dim Crr, V, xR, n
  5. TT = Timer
  6. Set Y = CreateObject("Scripting.Dictionary")
  7. Set Z = CreateObject("Scripting.Dictionary")
  8. Set V = CreateObject("Scripting.Dictionary")
  9. Set Z = ActiveSheet.Cells
  10. For i = 1 To 4
  11.    Set V(i) = CreateObject("Scripting.Dictionary")
  12. Next
  13. R = Z(Rows.Count, "D").End(xlUp).Row '³Ì«á¤@¦æ
  14. W = Z(12, Columns.Count).End(xlToLeft).Column '³Ì«á¤@Äæ
  15. Crr = Z(12, 33).Resize(R - 11, W - 32)
  16. Z = Z(1, 1).Resize(R, W) '©w¸q¸ê®Æ½d³ò--A1¦Ü¾ã­Ó°Ï
  17. For i = 1 To 13 Step 4
  18.    Y.Add Mid(Z(11, i + 12), 2, 2), (i + 3) / 4
  19. Next
  20. For i = 33 To W Step 4
  21.    P = Right(Split(Z(11, i), "]")(0), 2)
  22.    V(Y(P)).Add V(Y(P)).Count, i
  23. Next
  24. ReDim Brr(1 To R - 12, 1 To 20) '³]ªÅ°}¦C
  25. For i = 13 To R
  26.    For Each xR In V(1)
  27.       If Z(i, V(1)(xR) + 1) > Brr(i - 12, 2) Then
  28.          Brr(i - 12, 1) = Z(i, V(1)(xR))
  29.          Brr(i - 12, 2) = Z(i, V(1)(xR) + 1)
  30.       End If
  31.       If Z(i, V(1)(xR) + 1) - Z(i, V(1)(xR)) > Brr(i - 12, 3) Then
  32.          Brr(i - 12, 3) = Z(i, V(1)(xR) + 1) - Z(i, V(1)(xR))
  33.       End If
  34.    Next
  35.    For n = 1 To 3
  36.       For Each xR In V(n + 1)
  37.          Brr(i - 12, n * 4 + 1) = Brr(i - 12, n * 4 + 1) + Z(i, V(n + 1)(xR))
  38.          Brr(i - 12, n * 4 + 2) = Brr(i - 12, n * 4 + 2) + Z(i, V(n + 1)(xR) + 1)
  39.          Brr(i - 12, n * 4 + 3) = Brr(i - 12, n * 4 + 2) - Brr(i - 12, n * 4 + 1)
  40.       Next
  41.    Next
  42.    For n = 1 To 3
  43.       For j = 1 To 3
  44.          Brr(i - 12, 16 + n) = Brr(i - 12, 16 + n) + Brr(i - 12, j * 4 + n)
  45.       Next
  46.    Next
  47. Next i
  48. [M13].Resize(UBound(Brr), UBound(Brr, 2)) = Brr
  49. MsgBox Timer - TT
  50. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD