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

[µo°Ý] ¶ñ¤J¼t¯Ê&µù¸Ñ

¦^´_ 3# ­ã´£³¡ªL

­ã¤j,
¥t¤@Ãþ¦ü«e­±ªºµù¸Ñ¸ü¤J,¦ý¦]¬°¤£¦P®É¶¡µo¥Í,»Ý­n³æ¿Wµ{¦¡,
³o­Óµ{¦¡ªº³W«h¤ñ¸û¦h,§Ú¤£ª¾¹D«ç»ò¤U¤â,¤]½ÐÀ°¦£....
­«·s¾ã²z³W«h¦p¤U¡G(µ{¦¡»P ¤ë®w¦sªí & ³Ì·s®w¦sB ¬O¤À¶}ªºÀÉ®×)   ¸ü¤J¹L¤¹¤é¦L.rar (822.24 KB)
1) ¤ë®w¦sªíAU:AVÄ檺¼Æ¾Ú,·|¦Û¦æ¶ñ¤J,¥u­n¼W¥[µù¸Ñ´N¦n,¶}±Ò¤è¦¡¥Î *¤ë®w¦sªí*

2) ¤é´Á¹ïÀ³¡G¨Ó·½: ³Ì·s®w¦sB H1 ¬°4/21,«h¹ïÀ³ ¥ØªºÀÉ¡G¤ë®w¦sªí.xlsxªºsheet 21

3) CK_1~CK_4<0,¬°¹L¤¹,«h§â¹ïÀ³¸ê®Æ,¦b¤ë®w¦sªí·s¼Wµù¸Ñ
³Ì·s®w¦sB.xlsxªº¹ïÀ³¸ê®Æ¦p¤U,
CK_1 ¹ïÀ³ ¤é´Á1(GE) ¹ïÀ³ ¤p­p1(GQ)               
CK_2 ¹ïÀ³ ¤é´Á2(GH) ¹ïÀ³ ¤p­p2(GR)
CK_3 ¹ïÀ³ ¤é´Á3(GK) ¹ïÀ³ ¤p­p3(GS)
CK_4 ¹ïÀ³ ¤é´Á4(GN) ¹ïÀ³ ¤p­p4(GT)

4) ³Ì·s®w¦sB.xlsxªº ED:EEÄ榳¼Æ¾Úªº¸Ü,«h ¤ë®w¦sªí.xlsxªº AU:AV¤]·|¶ñ¤J¦P¼Ë¼Æ¾Ú,¥B­n·s¼Wµù¸Ñ

5) EX1
³Ì·s®w¦sB ªº®Æ¸¹ A1,¨äCK_1 & CK_2ªº­È<0
«h·s¼W¤ë®w¦sªí.xlsxµù¸Ñ:
AUÄæ
¤é¦L5/5 * 36½c
¤é¦L5/7 * 140½c
AVÄæ
¤é¦L5/5 * 5

6) EX2
³Ì·s®w¦sB ªº®Æ¸¹ A16¨äCK_1 ªº­È<0
«h·s¼W¤ë®w¦sªí.xlsxµù¸Ñ:
AVÄæ
¤é¦L5/9 * 215

TOP

¦^´_ 14# ­ã´£³¡ªL

­ã¤j,
¨C¤ë·|ÅܰʪºÀɦW,«ü©wÀx¦s®æ§@¥Î¤£¤j,§ÚÁÙ¬O·Q¥Î*¤ë®w¦sªí*ªº¶}±Ò¤è¦¡,
²¤­×§ïµ{¦¡,¥i¥H¶}±ÒÀÉ®×,¦ýµLªk¸ü¤J¼t¯Ê,¥i§_À°¦£¬Ý¤U°ÝÃD©Ò¦b?
  1. Sub ¸ü¤J¼t¯Êµù¸Ñ()
  2. Dim Sht As Worksheet, PH$, FN$, xB As Workbook, xS As Worksheet
  3. Dim xD, xR As Range, Arr, R&, C&
  4. Application.ScreenUpdating = False
  5. Application.Calculation = xlManual
  6. Set Sht = Workbooks("³Ì·s®w¦sB.xlsx").Sheets("­¸¤ñ")  '¨Ó·½
  7. PH = "T:\½d¨Ò\"
  8. FN = Dir(PH & "*¤ë®w¦sªí*.xlsx")
  9. Do While FN <> ""
  10. On Error Resume Next: Set xB = Workbooks(FN): On Error GoTo 0
  11. If xB Is Nothing Then Set xB = Workbooks.Open(PH & FN) '¤½¥Î®w¦sªí
  12. FN = Dir
  13. Loop

  14. xB.Activate '¤½¥Î®w¦sªí
  15. On Error Resume Next: Set xS = xB.Sheets(Day(Sht.[H1]) & ""): On Error GoTo 0  '¤ñ¹ï¤é´Á
  16. If xS Is Nothing Then MsgBox "¡e¤é®w¦sªí¡f¤£¦s¦b! ": Exit Sub
  17. If xS.[J2] = "***" Then MsgBox "¥»¤é®w¦s¤w¦©°£! ": Exit Sub
  18. '-------------------------------------
  19. Set xD = CreateObject("Scripting.Dictionary") '°O¿ý[¨Ó·½]Äæ¦ì¸m
  20. For Each xR In Range(xS.[E4], xS.[E65536].End(xlUp)) '¤½¥Î®w¦sªí
  21.     If xR <> "" Then xD(xR & "") = xR.Row
  22. Next
  23. For Each xR In xS.[J3:AZ3] '°O¿ý¤½¥Î®w¦sªí[°Ó«~¦WºÙ]¦C¦ì¸m
  24.     If xR = "" Or xR = "¦X­p" Then Exit For
  25.     xD(xR & "") = xR.Column
  26. Next
  27. '-------------------------------------
  28. R = Sht.[H65536].End(xlUp).Row  '¥H¨Ó·½[°Ó«~¦WºÙ]¬°¸ê®Æ¦C¼Æ
  29. Arr = Sht.Range("BJ4:CB" & R)  '¨Ó·½¼t¯Ê½d³ò
  30. For i = 1 To UBound(Arr)
  31.     R = xD(Sht.[H4].Cells(i, 1) & "") '¨ú±o¨Ó·½[°Ó«~¦WºÙ]¦C¦ì¸m
  32.     If R = 0 Then GoTo i01
  33. For j = 1 To UBound(Arr, 2)
  34.     C = xD(Sht.[BJ3].Cells(1, j) & "") '¨ú±o[¨Ó·½]Äæ¦ì¸m
  35.     If C = 0 Then GoTo j01
  36.     If Val(Arr(i, j)) = 0 Then GoTo j01
  37.     Set xR = xS.Cells(R, C)
  38. '    xR = Val(xR) - Arr(i, j) '¸ü¤J¼t¯Ê,Åܦ¨­È
  39.     xR = "=" & Val(xR) & "-" & Arr(i, j)  '¸ü¤J¼t¯Ê
  40.     xR.NoteText "PJ:" & Chr(10) & "¼t¯Ê*" & Arr(i, j) 'µù¸Ñªº¤º®e,Chr(10)´«¦æ
  41.     With xR.Comment.Shape 'µù¸Ñªº®Ø¤j¤p
  42.         .Top = xR.Top
  43.         .Left = xR.Cells(1, 2).Left + 1
  44.         .Height = xR.Height + 12
  45.         .Width = 50
  46. '        .TextFrame.Characters.Font.Size = 9   '¦Û­q¦rÅé¤j¤p,¦b®a¥i¥H¹B§@,¦ý¤½¥q¤£¦æ
  47.         '.Shadow.Visible = False '¨ú®ø³±¼v
  48.     End With

  49. j01: Next j
  50. i01: Next i
  51. xS.[J2] = "***" '¦©°£®w¦s¥H3¬Pµù°O(ÁקK­«ÂЦ©°£)
  52. Application.Calculation = xlCalculationAutomatic
  53. Application.GoTo xS.[J3]  '¤½¥Î®w¦sªí°_©l¦C¦ì¸m
  54. End Sub
½Æ»s¥N½X

TOP

¦^´_ 13# PJChen


ÀɮצWºÙ¥Î«ü©wÀx¦s®æ¿é¤J¤º®e¨Ó¦s¨ú~~

TOP

¦^´_ 3# ­ã´£³¡ªL
­ã¤j¦n,

¦]¬°¤ë®w¦sªíªº¦WºÙ¨C­Ó¤ë³£·|¤£¦P,§Ú·Q§ï¬°¶}±ÒÀɮפ覡¬° *¤ë®w¦sªí*
½Ð°Ýµ{¦¡­n¦p¦ó­×§ï?

TOP

¦^´_ 3# ­ã´£³¡ªL
¸É¥R¡G
³W«h¦p¤U¡G
³Ì·s®w¦sB H1 ¬°4/21,«h¹ïÀ³¤ë®w¦sªí.xlsxªºsheet 21
³Ì·s®w¦sB ED¹ïÀ³ ¤ë®w¦sªíAU
³Ì·s®w¦sB EE¹ïÀ³ ¤ë®w¦sªíAV
³Ì·s®w¦sB GA:GDªºCK­È<0«h¬°¹L¤¹¦¬(¦³¥i¯à¦hµ§<0,©Ò¥HGA:GDªºCK­È,­n¯à¥þ³¡³£À˵ø)
·íEFÄæ(¦^¼t¼Æ­È)ªº¦X­p>0,
«h´M§äGA:GDªºCK­È<0ªºÄæ¦ì
¦P®É³Ì·s®w¦sB GQ:GTªº¤p­pÄæ¦ì,¤]¬O¹ïÀ³GA:GDªºCK­È
·íGA:GDªºCK­È<0,«h¥i¨úGQ:GTªº¤p­p...¬°¹L¤¹¼Æ¶q

°²³]¡G
EF17>0
CK_1 >0 (µL¹L¤¹,¤£¤©­p¤J)
CK_2 = 0  (µL¹L¤¹,¤£¤©­p¤J)
CK_3 < 0 (¹L¤¹,«hGS17ªº¤p­p3¼Æ­È¬°¹L¤¹)
CK_4 ªÅ¥Õ  (ªí¥ÜµL¼Æ¾Ú,¤£¤©­p¤J)
GQ:GTªº¤p­pÄæ¦ìªº©Ò¦³¹L¤¹¦X­p = EFÄ檺¦^¼t¦X­p
¹L¤¹¸ê®Æ¸ü¤J ¤ë®w¦sªíªº¬Û¹ïÄæ¦ì ¼W¥[µù¸Ñ
¦bAU:AVÄæ,¼W¥[µù¸Ñ¤å¦r(°²³]­È) "¤é¦L5/9 * 12"
­Y¦³¦hµ§¹L¤¹¼Æ,«h´«¦æ
¤é¦L5/9 * 12
¤é¦L5/10 * 10
....¨Ì¦¹Ãþ±À

TOP

¦^´_ 3# ­ã´£³¡ªL

­ã¤j,
¦P¤@ÀÉ®×,¦³¨ä¥LÄæ¦ì,¤]»Ý¥Î¨ìÃþ¦üªºµù¸Ñ¸ü¤J,¦ý¦]¬°¬O¤£¦P®É¶¡µo¥Í,»Ý­n³æ¿Wµ{¦¡, ¸ü¤J¹L¤¹¤é¦L.rar (820.83 KB)
³W«h¦p¤U¡G
³Ì·s®w¦sB H1 ¬°4/21,«h¹ïÀ³¤ë®w¦sªí.xlsxªºsheet 21
³Ì·s®w¦sB ED¹ïÀ³ ¤ë®w¦sªíAU
³Ì·s®w¦sB EE¹ïÀ³ ¤ë®w¦sªíAV
³Ì·s®w¦sB GA:GDªºCK­È<0«h¬°¹L¤¹¦¬
·íEFÄæ(¦^¼t¼Æ­È)ªº¦X­p>0,
«h´M§äGA:GDªºCK­È<0ªºÄæ¦ì
EX:
EF17>0
¥BGA17ªºCK1<0
«hGE17ªº¤é´Á1´N¸ü¤J¤ë®w¦sªíªº¬Û¹ïÄæ¦ì
¦bAU:AVÄæ,¼W¥[µù¸Ñ¤å¦r "¤é¦L5/9"

TOP

¦^´_ 8# ­ã´£³¡ªL

­ã¤j,
§Ú§ï¦n¤F,ÁÂÁ¡I

TOP

¦^´_ 8# ­ã´£³¡ªL

­ã¤j,
ÁÙ¬O¤£¦æ,³o¼Ë·|¶Ã§ì¤u§@ªí,§Ú§âµ{¦¡¥Î§Ú²{¦æªº°µªk©ñ¦bMacro_1
³Â·ÐÀ°¦£¬Ý¤U...·PÁÂ

½d¨Ò0426.rar (259.02 KB)

TOP

¦^´_ 7# PJChen


Set Sht = ActiveSheet

TOP

¥»©«³Ì«á¥Ñ PJChen ©ó 2020-4-26 17:34 ½s¿è

¦^´_ 6# ­ã´£³¡ªL

­ã¤j,
§Ú¬O¥Î§A¦^ÂЪºÀÉ®×´ú¸Õ,ÀÉ®×Ãþ«¬.xls, ¦]µ{¦¡»P¥­¤éÀɮפ£©ñ¦b¤@°_ªº,©Ò¥H§Ú­×§ï¬õ¦r³¡¥÷,¦ýµLªk¹B§@,¦A³Â·Ð«üÂI¡I
Set Sht = Sheets("­¸¤ñ")  '³o¸Ì¥d¦í¤F,µLªk°õ¦æ
FN = "¤ë®w¦sªí.xls": PH = "T:\½d¨Ò\"
On Error Resume Next: Set xB = Workbooks(FN): On Error GoTo 0
If xB Is Nothing Then Set xB = Workbooks.Open(PH & FN)
'ThisWorkbook.Activate
xB.Activate  '³o¸Ì¤]¦³°ÝÃD,µLªk°õ¦æ

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD