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

[µo°Ý] ¥ÎVBA¨Ó°õ¦æSUMPRODUCT¦h±ø¥ó²Î­p

¦^´_ 1# b9208
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim D(1 To 2) As Object, i As Integer, M As String
  4.     Dim R As Integer, C As Integer, A As Range
  5.     Set D(1) = CreateObject("scripting.dictionary")    '¦r¨åª«¥ó
  6.     Set D(2) = CreateObject("scripting.dictionary")
  7.     With Sheets("©ú²Ó")
  8.         i = 6
  9.         Do While .Cells(i, "d") <> ""
  10.             M = .Cells(i, "D") & Mid(.Cells(i, "E"), 1, 4) & .Cells(i, "F")
  11.             D(1)(M) = D(1)(M) + 1                                                               '¥þ³¡
  12.             M = .Cells(i, "D") & Mid(.Cells(i, "E"), 1, 4) & .Cells(i, "F") & .Cells(i, "L")
  13.             D(2)(M) = D(2)(M) + 1                                                               '°Ï°ì
  14.             i = i + 1
  15.         Loop
  16.     End With
  17.      With Sheets("²Î­p")
  18.         For Each A In .Range("F3:J12,F18:J27,F33:J42,F48:J57").Areas                     '­×¥¿¬°§Aªº¥þ³¡ ¤Î °Ï°ì ªº½d³ò
  19.             With A
  20.                 For R = 3 To .Rows.Count - 1
  21.                     For C = 2 To .Columns.Count
  22.                         If .Cells(1) = "¥þ³¡" Then                  '¥þ³¡
  23.                             .Cells(R, C) = D(1)(.Cells(R, 1) & Mid(.Cells(1, C), 1, 4) & .Cells(2, C))
  24.                         Else                                        '°Ï°ì
  25.                              .Cells(R, C) = D(2)(.Cells(R, 1) & Mid(.Cells(1, C), 1, 4) & .Cells(2, C) & .Cells(1))
  26.                         End If
  27.                     Next
  28.                 Next
  29.                 For C = 2 To .Columns.Count
  30.                     .Cells(.Rows.Count, C).FormulaR1C1 = "=SUM(R[-" & .Rows.Count - 3 & "]C:R[-1]C)"  '¤½¦¡
  31.                     .Cells(.Rows.Count, C) = .Cells(.Rows.Count, C).Value
  32.                 Next
  33.         
  34.             End With
  35.         Next
  36.      End With
  37. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¯¸¦b¥b¸ô¡A¤ñ¨«¨ì¥Ø¼Ð§ó¨¯­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD