- ©«¤l
- 913
- ¥DÃD
- 150
- ºëµØ
- 0
- ¿n¤À
- 1089
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 2019
- ¾\ŪÅv
- 50
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2011-8-28
- ³Ì«áµn¿ý
- 2023-7-19
|
¦^´_ 51# jcchiang
±z¦n,
ªí®æ¤W¶Ç®É¦³¤p¤pÅܰʤF®æ¦¡,¤½¦¡§Ñ¤F§ï&¦³³¡¥÷µ{¦¡¤w§ï¦¨§Ú·Qnªº°õ¦æ¤è¦¡,¤£¹L¤£ª¾¬O¼gªk¤£¦n,©Î¸ê®Æ¤Ó¦h,¶]±o¦³ÂIºC,
¸Õ¹L³æ¤@Äæ±q¦~ªì¸ê®Æ¶}©l§ó·s,µ²ªGºC±o¹³·í¾÷¤@¼Ë,¦pªG¯à«ü¾É¤U§ó§Öªº¼gªk,´N¤Ó¦n¤F¡I
·s¼g¥hÁöµM§¹¦¨,¦ý§Ú¤£ª¾¦p¦ó§ï¬°°}¦C,©Ò¥H¬O¨CÄ檺§ó·s¤À¶}¼g¡I- Sub ¥_°Ï_A_¨ú¦~¤ë()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'A ¨úBÄæ¦~.¤ë
- For Each xR In Range([b3], [b65535].End(3)) '¦V¤W End(3) = End(xlup).Row
- If xR >= d Then
- xR.Offset(, -1) = Year(xR) & ".." & Month(xR)
- End If
- Next
- End Sub
- Sub ¥_°Ï_E_±ÄÁʳ渹½X()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'E ±ÄÁʳ渹½X
- For Each xR In Range([b3], [b65535].End(3))
- If xR.Offset(, 16) = "" Then 'RÄæµL³æ¸¹
- xR.Offset(, 3) = "µL¥æ³f"
- End If
- If xR >= d And xR.Offset(, 16) <> "" Then
- xR.Offset(, 3) = xR.Offset(, 18) & xR.Offset(, 17) & xR.Offset(, 16) 'T&S&R
- End If
- Next
- End Sub
- Sub ¥_°Ï_K_µ²¾l()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'K µ²¾l
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d Then 'k+g-f-h-i+j
- xR.Offset(, 9) = xR.Offset(-1, 9) + xR.Offset(, 5) - xR.Offset(, 4) - xR.Offset(, 6) - xR.Offset(, 7) + xR.Offset(, 8)
- End If
- Next
- End Sub
- Sub ¥_°Ï_L_¤j_µ²¾l()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'L ¤j,µ²¾l
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d And xR.Offset(, 1) = "¤j" Then 'l+g-f+j-n
- xR.Offset(, 10) = xR.Offset(-1, 10) + xR.Offset(, 5) - xR.Offset(, 4) + xR.Offset(, 8) - xR.Offset(, 12)
- Else 'l+j-n
- xR.Offset(, 10) = xR.Offset(-1, 10) + xR.Offset(, 8) - xR.Offset(, 12)
- End If
- Next
- End Sub
- Sub ¥_°Ï_M_¬ü_µ²¾l()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d And xR.Offset(, 1) = "Ÿ" Then 'm+g-f-o
- xR.Offset(, 11) = xR.Offset(-1, 11) + xR.Offset(, 5) - xR.Offset(, 4) - xR.Offset(, 13)
- Else 'm-o
- xR.Offset(, 11) = xR.Offset(-1, 11) - xR.Offset(, 13)
- End If
- Next
- End Sub
- Sub ¥_°Ï_U_¬£ªO¹ïÀ³³æ¾Ú¤é()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'U'¬£ªO¹ïÀ³³æ¾Ú¤é
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d And (xR.Offset(, 2) = "¤¤©M" Or xR.Offset(, 2) = "¤º´ò" Or xR.Offset(, 2) = "¦Á¤î") Then
- xR.Offset(, 19) = xR
- Else
- xR.Offset(, 19) = xR + 1
- End If
- Next
- End Sub
- Sub ¥_°Ï_X_¬£ªOµ²¾l()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'X'¬£ªOµ²¾l g+j-h-i-w
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d Then 'x+g+j-h-i-w
- xR.Offset(, 22) = xR.Offset(-1, 22) + xR.Offset(, 5) + xR.Offset(, 8) - xR.Offset(, 6) - xR.Offset(, 7) - xR.Offset(, 21)
- End If
- Next
- End Sub
- Sub ¥_°Ï_Y_½LÂI®t²§()
- Dim Sh As Worksheet, xS As Worksheet, xR
- Set xS = ThisWorkbook.Sheets("VBA") 'µ{¦¡¨Ó·½
- Set Sh = Workbooks("¥þ¬Ù®Ö¾P©ú²Ó.xlsx").Sheets("¥_°Ï")
- d = xS.[AA3] 'Date
- Sh.Activate
- '------------ 'Y'½LÂI®t²§
- For Each xR In Range([b3], [b65535].End(3))
- If xR >= d And xR.Offset(, 24) = "" Then
- xR.Offset(, 23) = ""
- Else 'z-x
- xR.Offset(, 23) = xR.Offset(, 24) - xR.Offset(, 22)
- End If
- Next
- End Sub
½Æ»s¥N½X ¥Ø«e¥u³Ñ3Ä檺¤½¦¡,¦]¥]§t¤Fcountifªº¨ç¼Æ,¬d¤F¨Ç¸ê®Æ,¨S§ä¨ìÃö©ócountifªº¨ç¼Æ¦p¦ó§ï¬°VBAªº¼gªk¡I- Range("N3:N" & xRow).Formula = "=¥_°Ï_¤j_¤¤«n°Ï" '=IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=1,SUMIFS(¥x¤¤!$D:$D,¥x¤¤!$B:$B,"¤j",¥x¤¤!$A:$A,¥_°Ï!$B3),IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=2,SUMIFS(·s¦Ë!$D:$D,·s¦Ë!$B:$B,"¤j",·s¦Ë!$A:$A,¥_°Ï!$B4),IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=3,SUMIFS(«n°Ï!$D:$D,«n°Ï!$B:$B,"¤j",«n°Ï!$A:$A,¥_°Ï!$B5),"")))
- Range("N3:N" & xRow).Value = Range("N3:N" & xRow).Value
- Range("O3:O" & xRow).Formula = "=¥_°Ï_¬ü_¤¤«n°Ï" '=IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=1,SUMIFS(¥x¤¤!$D:$D,¥x¤¤!$B:$B,"¬ü",¥x¤¤!$A:$A,¥_°Ï!$B3),IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=2,SUMIFS(·s¦Ë!$D:$D,·s¦Ë!$B:$B,"¬ü",·s¦Ë!$A:$A,¥_°Ï!$B4),IF(COUNTIF(¥_°Ï!$B$3:$B3,¥_°Ï!$B3)=3,SUMIFS(«n°Ï!$D:$D,«n°Ï!$B:$B,"¬ü",«n°Ï!$A:$A,¥_°Ï!$B5),"")))
- Range("O3:O" & xRow).Value = Range("O3:O" & xRow).Value
- Range("V3:V" & xRow).Formula = "=IF(COUNTIFS(B$3:B3,B3,D$3:D3,D3)=1,SUMIFS(W:W,B:B,B3,D:D,D3)-SUMIFS(F:F,B:B,U3,D:D,D3),0)" '¬£ªO-¥æªO®t²§
- Range("V3:V" & xRow).Value = Range("V3:V" & xRow).Value
½Æ»s¥N½X |
|