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

½Ð°Ý¦p¦ó±N°}¦C¸ê®Æ°µ¾ã²z¦b¬d§äÀÉÅã¥Ü¥X¨Ó?

½Ð°Ý¦p¦ó±N°}¦C¸ê®Æ°µ¾ã²z¦b¬d§äÀÉÅã¥Ü¥X¨Ó?

¦p¦³¤W¤d­ÓÀÉ®×¥¦ªºÀɦW¬OA001.XLS....,½Ð°Ý§Ú¥´¶}¬d´MÀɮצbA1Äæ¦ì¿é¤JA001«ö«ü¥O«ö¶s
´N¥i¥H±qA3¦ì¸mÅã¥Ü¹³³o¼Ëªº®æ¦¡½Ð°ÝVBA­n¦p¦ó¼g?ÁÂÁ§A
TEST1.rar (5.52 KB)

ÁÂÁ¶W¯Åª©¥D¤S¦h¾Ç¤F¤@ÂI...

TOP

Workbooks.Open Filename:=ThisWorkbook.Path & "\" & [a1] & ".xls"
    With ActiveSheet
        n = .[a65536].End(xlUp).Row
        arr = .Range(.[a1], .Cells(n, 5))
°õ¦æ¨ì³o¤@¥y®É¡A¤w§â©Ò¦³¼Æ¾Ú¦s¦b°}¦C°O¾Ð¤¤¤F¡A¤§«áªº¦s¨ú³£¦b³o­Ó°}¦C¤¤
¥´¶}ªº¬¡­¶Ã¯¤w¸g¥Î¤£µÛ´N¥i¥HÃö³¬¤F¡C
§A­n²¾¨ì«á­±¦AÃö¤]ÀH§A¤F¡C¤£¥i¯à²¾¨ì«á­±¥hµ{¦¡¤~·|okªº¡C

TOP

¶W¯Åª©¥D¹ï¤£°_°Õ!§Ú¦b¸Õ®É¨Ó·½ÀÉclose®É«á­±ªº¸ê®Æ¨SÅã¥Ü¥X¨Ó,©Ò¥H´N§âActiveWorkbook.Close True²¾¨ì«á­±´Nok¤F,Åý§Ú«ÜºÃ°Ý¬°¤°»ò¨Ó·½ÀÉclose
¸ê®Æ¬O¦s¦b­þ°µ³B²z?©Ò¥H¶W¯Åª©¥D¨º¦³¥i¯à¼g¿ù,¬O§Ú¤Óµæ°Õ!¤£¨£©Ç..

TOP

¥»©«³Ì«á¥Ñ oobird ©ó 2011-8-13 10:52 ½s¿è

³á¡AÅý§Ú¦³ÂIºÃ´b,¦]¬°¶W¯Åª©¥D
¼gªº¨º·|¦³°ÝÃD,¨SÃö«Y
¡A«¢«¢¡I¦b¤U·Q½Ð±Ð¡A¬O­þ¸Ì·|¦³°ÝÃD¡H
»¡¥X¨Ó¤]¦nÅý§Ú¾Ç²ß¾Ç²ß¡C

TOP

ÁÂÁ¶W¯Åª©¥D§Úª¾¹D¦p¦ó°µ¤F,¨Ó·½ÀɬO§_¤Ó¦­Ãö¤F!Åý§Ú¦³ÂIºÃ´b,¦]¬°¶W¯Åª©¥D
¼gªº¨º·|¦³°ÝÃD,¨SÃö«Y§Ú·|¥h¤F¸Ñªº,ÁÂÁ§Aªº«ü¾É....

TOP

  1. Sub yy()
  2.     Dim n%, i%, j%, m%, arr, arr2(), b()
  3.     ActiveSheet.UsedRange.Offset(2, 0) = ""
  4.     Application.ScreenUpdating = False
  5.     Workbooks.Open Filename:=ThisWorkbook.Path & "\" & [a1] & ".xls"
  6.     With ActiveSheet
  7.         n = .[a65536].End(xlUp).Row
  8.         arr = .Range(.[a1], .Cells(n, 5))
  9.         ReDim arr2(1 To 5, 1 To UBound(arr))
  10.     End With
  11.     ActiveWorkbook.Close True
  12.     Set d = CreateObject("scripting.dictionary")
  13.     For i = 1 To n
  14.         If i = 1 Then x = "Á`­p" Else x = arr(i, 4) - arr(i, 5)
  15.         b = Array(arr(i, 1), arr(i, 2), arr(i, 4), arr(i, 5), x)
  16.         If Not d.exists(arr(i, 1)) Then
  17.             m = m + 1
  18.             d(arr(i, 1)) = m
  19.             For j = 1 To 5
  20.                 arr2(j, m) = b(j - 1)
  21.             Next
  22.         Else
  23.             For j = 3 To 5
  24.                 arr2(j, d(arr(i, 1))) = arr2(j, d(arr(i, 1))) + arr(i, j)
  25.             Next
  26.         End If
  27.     Next
  28.     [a3].Resize(m, 5) = Application.Transpose(arr2)
  29.     Application.ScreenUpdating = True
  30. End Sub
½Æ»s¥N½X
a.gif

TOP

§Ú¦n¶Hµo¿ù°Ï¤F!

TOP

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