- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-9-15 14:19 ½s¿è
¦^´_ 4# s3526369
ÁÂÁ«e½úµoªí¦¹¥DÃD
ÁÂÁÂsamwang«e½ú«ü¾É
ÁÂÁÂã´£³¡ªL«e½úªº ¦r¨å¤¤ªº¦r¨å
«á¾Ç²ß±o«Ü¦h§Þ¥©
1.¦r¨å¦W¦r°Ñ¼Æ¤Æ
2.¸ê®ÆˤJ¦r¨å°j°é¤Æ
3..IIF ¨ç¼Æ¸É 0- Option Explicit
- Sub TEST_2()
- Application.ScreenUpdating = False
- Dim x, i, QA, QB, T, S, Srr, Arr, Ac, xR, C
- Dim Trr, Brr, Crr, Rs, Rqs, Rqn, Ras, Ran, B
- T = Timer
- Set Srr = CreateObject("Scripting.Dictionary")
- Set Trr = CreateObject("Scripting.Dictionary")
- S = Split("¤J®w©ú²Ó,¥þ¾÷ºØBOM,A»Ý¨D,b»Ý¨D,«ü¹Ï©ú²Ó,Ü®w®w¦s", ",")
- For i = 0 To UBound(S)
- Set Srr(i) = Sheets(S(i))
- Set Trr(i) = CreateObject("Scripting.Dictionary")
- Next
- Rs = Rows.Count
- Ac = Srr(5).Cells(Rs, 1).End(3).Row
- Arr = Range(Srr(5).[N4], Srr(5).Cells(Ac, 1))
- C = Array(15, 18, 16, 26, 1, 8, 1, 8, 6, 12)
- For i = 0 To UBound(C) Step 2
- Set Rqs = Srr(i / 2).Cells(1, C(i))
- Set Rqn = Srr(i / 2).Cells(Rs, C(i)).End(3)
- Brr = Srr(i / 2).Range(Rqs, Rqn)
- Set Ras = Srr(i / 2).Cells(1, C(i + 1))
- Set Ran = Srr(i / 2).Cells(Rqn.Row, C(i + 1))
- Crr = Srr(i / 2).Range(Ras, Ran)
- For x = 1 To UBound(Brr)
- B = Brr(x, 1)
- Trr(i / 2)(B) = Trr(i / 2)(B) + Crr(x, 1)
- Next
- Next
- For i = 1 To Ac - 3
- xR = Arr(i, 1)
- Arr(i, 5) = IIf(Trr(0)(xR), Trr(0)(xR), 0) '¤J®w¦Xp
- Arr(i, 3) = IIf(Trr(1)(xR), Trr(1)(xR), 0) '¤½¥qÁ`»Ý¨D
- Arr(i, 10) = IIf(Trr(2)(xR), Trr(2)(xR), 0) 'AÜ
- Arr(i, 9) = IIf(Trr(3)(xR), Trr(3)(xR), 0) 'BÜ
- Arr(i, 13) = IIf(Trr(4)(xR), Trr(4)(xR), 0) 'Á`¥X³f
- QA = Arr(i, 4) + Arr(i, 5) 'Ü®w®w¦s
- QB = Arr(i, 11) + Arr(i, 12)
- Arr(i, 8) = QA - QB - Arr(i, 10) - Arr(i, 9) - Arr(i, 13) '¤½¥qÜ
- Arr(i, 7) = QA - QB - Arr(i, 13) 'Á`¼Æ
- Next i
- C = Array(, 3, 5, 7, 8, 9, 10, 13)
- For i = 1 To UBound(C)
- Srr(5).Cells(4, C(i)).Resize(UBound(Arr), 1) = Application.Index(Arr, , C(i))
- Next
- Set Arr = Nothing
- Set Brr = Nothing
- Set Crr = Nothing
- MsgBox "¦@¯Ó®É¡G" & Timer - T & " ¬í"
- End Sub
½Æ»s¥N½X |
|