- ©«¤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
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-10-6 11:15 ½s¿è
¦^´_ 1# fantersy
ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò
¥H¦r¨å°O¦ípºâ¥²n¸ê®Æ,¦AË¥X°µpºâ:
Option Explicit
Sub TEST()
Dim Brr, Crr, Drr, Z, i&, T$
Crr = Range([axmr450!R1], [axmr450!A65536].End(3))
Drr = Range([®w¦s!G1], [®w¦s!A65536].End(3))
Brr = Range([q³æ¥¼¥æ!B3], [q³æ¥¼¥æ!B65536].End(3))
Set Z = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(Drr)
T = Trim(Drr(i, 5)) & "|" & Trim(Drr(i, 1))
Z(T) = Z(T) + Val(Drr(i, 6))
Next
For i = 2 To UBound(Crr)
T = Trim(Crr(i, 7))
Z(T & "|¼Æ¶q") = Z(T & "|¼Æ¶q") + Val(Crr(i, 10))
Z(T & "|Á`¥X") = Z(T & "|Á`¥X") + Val(Crr(i, 18))
Next
For i = 1 To UBound(Brr)
T = Brr(i, 1)
Brr(i, 1) = Z(T & "|¼Æ¶q") - Z(T & "|Á`¥X") - Z("JMZ1" & "|" & T)
Next
[q³æ¥¼¥æ!G3].Resize(UBound(Brr), 1) = Brr
Set Z = Nothing: Erase Brr, Drr, Crr
End Sub
==============================
¸É¥R:
½d¨Ò¤¤¦³1¸U¦hÓ¤£¥i¨£ªº ¤å¦r®Ø©Î¹Ï¤ù....
Sub §R°£ª«¥ó()
With ActiveSheet.DrawingObjects
If .Count > 0 Then MsgBox .Count: .Delete
End With
End Sub
============================
¸É¥R¥t¤@¸Ñªk: (¥H¦r¨å°O¦í®Æ¸¹©Ò¦bªº°}¦C¯Á¤Þ¦C¸¹)
Option Explicit
Sub TEST_1()
Dim Brr, Crr, Drr, Z, i&, T$
Crr = Range([axmr450!R1], [axmr450!A65536].End(3))
Drr = Range([®w¦s!G1], [®w¦s!A65536].End(3))
Brr = Range([q³æ¥¼¥æ!B3], [q³æ¥¼¥æ!B65536].End(3))
Set Z = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(Brr): Z(Brr(i, 1)) = i: Brr(i, 1) = 0: Next
For i = 2 To UBound(Crr)
T = Trim(Crr(i, 7))
If Z(T) <> "" Then Brr(Z(T), 1) = Brr(Z(T), 1) + Val(Crr(i, 10)) - Val(Crr(i, 18))
Next
For i = 2 To UBound(Drr)
T = Trim(Drr(i, 1))
If Trim(Drr(i, 5)) = "JMZ1" And Z(T) <> "" Then Brr(Z(T), 1) = Brr(Z(T), 1) - Val(Drr(i, 6))
Next
[q³æ¥¼¥æ!G3].Resize(UBound(Brr), 1) = Brr
Set Z = Nothing: Erase Brr, Drr, Crr
End Sub |
|