- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
ÁÂÁ ¨â¦ì«e½ú
¤µ¤Ñ²ß±o
1.ˤJ¦r¨å°j°é¤Æ
2.¹w³]2±ø¥ó§k¦X¤~¥[Á`- Option Explicit
- Sub Ü®w®w¦s_20220917()
- Application.ScreenUpdating = False
- Dim x&, i&, È(1 To 17) As Long, QA, QB, T, S, Srr, Arr, Ac, xR, C
- Dim Trr, Brr, Crr, Rs, Rq1s, Rq1n, Ras, Ran, B, Äæd, ¯Srr, Drr
- Dim Rq2s, Rq2n, XA
- T = Timer
- Set Srr = CreateObject("Scripting.Dictionary")
- Set Trr = CreateObject("Scripting.Dictionary")
- Set ¯Srr = CreateObject("Scripting.Dictionary")
- ' 0 1 2 3 4 5 6 7 8
- S = Split("Ü®w®w¦s,¤J®w©ú²Ó,¥þ¾÷ºØBOM,A»Ý¨D,B»Ý¨D,«ü¹Ï©ú²Ó,¤½¥q½LÂI,°h®w,¼o®ÆÜ", ",")
- For i = 1 To UBound(S)
- Set Srr(i) = Sheets(S(i))
- Set Trr(i) = CreateObject("Scripting.Dictionary")
- Set ¯Srr(i) = CreateObject("Scripting.Dictionary")
- Next
- Rs = Rows.Count
- Ac = Sheets(S(0)).Cells(Rs, 1).End(3).Row
- Arr = Range(Sheets(S(0)).[N4], Sheets(S(0)).Cells(Ac, 1))
- 'vS, vC,zS, zC,xS,xC,zS, zC,zV
- ¯Srr(1) = Array("", 1, 18, 1, 15, 0, 1, 1, 99, "") '¤J®w¦Xp
- ¯Srr(2) = Array("", 2, 26, 2, 16, 0, 1, 2, 99, "") '¤½¥qÁ`»Ý¨D
- ¯Srr(3) = Array("", 3, 8, 3, 1, 0, 1, 3, 99, "") 'AÜ
- ¯Srr(4) = Array("", 4, 8, 4, 1, 0, 1, 4, 99, "") 'BÜ
- ¯Srr(5) = Array("", 5, 12, 5, 6, 0, 1, 5, 99, "") 'Á`¥X³f
- ¯Srr(6) = Array("", 6, 7, 6, 1, 0, 1, 6, 99, "") '¤½¥q½LÂI
- ¯Srr(7) = Array("", 7, 3, 7, 1, 0, 1, 7, 99, "") 'BÜ
- ¯Srr(8) = Array("", 8, 3, 8, 1, 0, 1, 8, 99, "") 'BÜ
- For i = 1 To UBound(S)
- Set Rq1s = Srr(¯Srr(i)(3)).Cells(1, ¯Srr(i)(4))
- Set Rq1n = Srr(¯Srr(i)(3)).Cells(Rs, ¯Srr(i)(4)).End(3)
- Brr = Srr(¯Srr(i)(3)).Range(Rq1s, Rq1n)
-
- Set Rq2s = Srr(¯Srr(i)(7)).Cells(1, ¯Srr(i)(8))
- Set Rq2n = Srr(¯Srr(i)(7)).Cells(Rq1n.Row, ¯Srr(i)(8))
- Drr = Srr(¯Srr(i)(7)).Range(Rq2s, Rq2n)
- Set Ras = Srr(¯Srr(i)(1)).Cells(1, ¯Srr(i)(2))
- Set Ran = Srr(¯Srr(i)(1)).Cells(Rq1n.Row, ¯Srr(i)(2))
- Crr = Srr(¯Srr(i)(1)).Range(Ras, Ran)
- For x = 1 To UBound(Brr)
- B = Brr(x, 1)
- If InStr(Drr(x, 1), ¯Srr(i)(9)) Or Drr(x, 1) & ¯Srr(i)(9) = "" Then
- Trr(i)(B) = Trr(i)(B) + Crr(x, 1)
- End If
- Next
- Next
- For i = 1 To Ac - 3
- xR = Arr(i, 1)
- QA = Trr(1)(xR) + Trr(6)(xR) 'Ü®w®w¦s
- QB = Trr(7)(xR) + Trr(8)(xR)
- Arr(i, 5) = Trr(1)(xR) '¤J®w¦Xp
- Arr(i, 13) = Trr(5)(xR) 'Á`¥X³f
- Arr(i, 3) = Trr(2)(xR) 'Á`»Ý¨D
- Arr(i, 8) = QA - QB - Trr(3)(xR) - Trr(4)(xR) - Trr(5)(xR) '¤½¥qÜ
- Arr(i, 9) = Trr(4)(xR) 'BÜ
- Arr(i, 10) = Trr(3)(xR) 'AÜ
- Arr(i, 7) = QA - QB - Trr(5)(xR) 'Á`¼Æ
- Arr(i, 4) = Trr(6)(xR)
- Arr(i, 11) = Trr(7)(xR)
- Arr(i, 12) = Trr(8)(xR)
- If Arr(i, 3) > 0 Then
- XA = Trr(6)(xR) + Trr(1)(xR) - Trr(7)(xR) - Trr(8)(xR) - Arr(i, 3)
- If XA >= 0 Then XA = 0
- Else
- XA = 0
- End If
- If Trr(1)(xR) = 0 Then Arr(i, 5) = 0
- If Trr(6)(xR) = 0 Then Arr(i, 4) = 0
- If Trr(2)(xR) = 0 Then Arr(i, 3) = 0
- If Trr(5)(xR) = 0 Then Arr(i, 13) = 0
- Arr(i, 6) = XA
- Next i
- C = Array(, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
- For i = 1 To UBound(C)
- Sheets(S(0)).Cells(4, C(i)).Resize(UBound(Arr), 1) = Application.Index(Arr, , C(i))
- Next
- MsgBox "¦@¯Ó®É¡G" & Timer - T & " ¬í"
- End Sub
½Æ»s¥N½X |
|