- ©«¤l
- 40
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 83
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2011-6-3
- ³Ì«áµn¿ý
- 2020-10-1
|
sFName = "C:\¸ê®Æ®w\" & tdate & "¤ë\" & stcok & "" & fdate & ".xls" ' «ü©w¬d§äÀɮ׸ô®|¥Ø¿ý"
Workbooks.Open Filename:=sFName, ReadOnly:=True ' ¶}ÀÉ
p = Sheets.Count
Do
With Sheets(p)
n = .[A65536].End(xlUp).Row
arr = .Range(.[A1], .Cells(n, 6))
ReDim arr2(1 To 5, 1 To UBound(arr)) '¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡
Set d = CreateObject("scripting.dictionary")
For i = 2 To n
chk = Mid(arr(i, 1), 1, 3)
If stcode = chk Then
x = arr(i, 4) - arr(i, 5)
b = Array(arr(i, 1), arr(i, 2), arr(i, 4), arr(i, 5), x)
If Not d.exists(arr(i, 1)) Then
M = M + 1
d(arr(i, 1)) = M
For j = 1 To 5
arr2(j, M) = b(j - 1)
Next
Else
For j = 3 To 5
arr2(j, d(arr(i, 1))) = arr2(j, d(arr(i, 1))) + b(j - 1)
Next
End If
Else
End If
Next
End With
On Error Resume Next
irow = wbook.[A65536].End(xlUp).Row
wbook.Range("A" & irow + 1).Resize(M, 5) = Application.Transpose(arr2)
p = p - 1: M = 0
Loop While p > 0
Application.DisplayAlerts = False
ActiveWorkbook.Close SaveChanges:=False
Sheets("Web").Activate
n = [A65536].End(xlUp).Row
arr = Range([A2], Cells(n, 6))
ReDim arr2(1 To 5, 1 To UBound(arr)) Set d = CreateObject("scripting.dictionary")
For i = 2 To n
b = Array(arr(i, 1), arr(i, 2), arr(i, 3), arr(i, 4), arr(i, 5))
If Not d.exists(arr(i, 1)) Then
M = M + 1
d(arr(i, 1)) = M
For j = 1 To 5
arr2(j, M) = b(j - 1)
Next
Else
For j = 3 To 5
arr2(j, d(arr(i, 1))) = arr2(j, d(arr(i, 1))) + b(j - 1)
Next
End If
Next
Range("g1").Resize(M, 5) = Application.Transpose(arr2)
¥Ø«e¥²¶·§â¦U¤u§@ªí³B²z§¹ªº¸ê®Æ©ñ¨ìsheet("web")ªº¤u§@ªí,¦A³B²z¤@¦¸
½Ð°Ý¦p¦ó³B²z¤@¦¸´N¦n,¹ï©ó°}¦C¸ê®Æ¯uªº«ÜÀYµh,·PÁ¤j¤j¯àÀ°§Ú¸Ñ´b!ÁÂÁµ½¤ß¤H¤h. |
|