Files
kary_lai/task2/plan/original.module
louiscklaw 35a0346de1 update,
2025-03-16 01:20:32 +08:00

96 lines
2.1 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sub ­«³]ªí®æ()
Dim ¥Ø«e½s¸¹ As Integer
Sheets("­q³æ").Range("D5,D10:E16").ClearContents
¥Ø«e½s¸¹ = Sheets("¸ê®Æ®w").Range("A1").CurrentRegion.End(xlDown).Value
Sheets("­q³æ").Range("G6").Value = ¥Ø«e½s¸¹ + 1
Sheets("­q³æ").Range("G7").Value = Date
End Sub
Sub Àx¦s­q³æ()
Dim «~¶µ¼Æ¶q As Integer, ªÅ¥Õ¦C As Integer
«~¶µ¼Æ¶q = WorksheetFunction.CountA(Sheets("­q³æ").Range("D10:D16"))
ªÅ¥Õ¦C = Sheets("¸ê®Æ®w").Range("A1").CurrentRegion.End(xlDown).Offset(1, 0).Row
Sheets("­q³æ").Range("D10:G10").Resize(«~¶µ¼Æ¶q).Copy
Sheets("¸ê®Æ®w").Range("D" & ªÅ¥Õ¦C).PasteSpecial xlPasteValues
Sheets("¸ê®Æ®w").Range("A" & ªÅ¥Õ¦C).Resize(«~¶µ¼Æ¶q).Value = Sheets("­q³æ").Range("G6").Value
Sheets("¸ê®Æ®w").Range("B" & ªÅ¥Õ¦C).Resize(«~¶µ¼Æ¶q).Value = Sheets("­q³æ").Range("G7").Value
Sheets("¸ê®Æ®w").Range("C" & ªÅ¥Õ¦C).Resize(«~¶µ¼Æ¶q).Value = Sheets("­q³æ").Range("D5").Value
Call ­«³]ªí®æ
MsgBox "¸ê®ÆÀx¦s§¹²¦"
End Sub
Sub ¬d¸ß­q³æ()
Dim ­q³æ½s¸¹ As Integer, ­q³æ¦ì¸m As Integer, «~¶µ¼Æ¶q As Integer
­q³æ½s¸¹ = Sheets("­q³æ").Range("G6").Value
«~¶µ¼Æ¶q = WorksheetFunction.CountIf(Sheets("¸ê®Æ®w").Range("A:A"), ­q³æ½s¸¹)
Sheets("­q³æ").Range("D5, D10:E16").ClearContents
If «~¶µ¼Æ¶q = 0 Then
MsgBox "¬dµL¦¹­q³æ"
Exit Sub
Else
­q³æ¦ì¸m = WorksheetFunction.Match(­q³æ½s¸¹, Sheets("¸ê®Æ®w").Range("A:A"), 0)
Sheets("¸ê®Æ®w").Range("D" & ­q³æ¦ì¸m).Resize(«~¶µ¼Æ¶q, 2).Copy
Sheets("­q³æ").Range("D10").PasteSpecial xlPasteValues
Sheets("­q³æ").Range("G7").Value = Sheets("¸ê®Æ®w").Range("B" & ­q³æ¦ì¸m).Value
Sheets("­q³æ").Range("D5").Value = Sheets("¸ê®Æ®w").Range("C" & ­q³æ¦ì¸m).Value
End If
End Sub
Sub ¦C¦L­q³æ()
Dim ÀɦW As String
ÀɦW = Format(Range("G6").Value, "00000")
Sheets("­q³æ").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="\\Mac\Home\Downloads\" & ÀɦW, _
IgnorePrintAreas:=False
End Sub