- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 4# yuan5447
¬O³o¼Ë¶Ü?- Option Explicit
- Sub Ex()
- Dim PrintMonTh As String, Rng(1 To 2) As Range, i As Integer, ii As Integer
- PrintMonTh = Format(DateAdd("M", -1, Date), "M¤ë") '¤W¤@¤ë¥÷
- PrintMonTh = InputBox("½Ð¿é¤J¤ë¥÷", , PrintMonTh) '¿é¤J¥¿½T¤ë¥÷
- If Val(PrintMonTh) <= 0 Or Mid(PrintMonTh, Len(PrintMonTh)) <> "¤ë" Then GoTo ER '
- 'Val(PrintMonTh) <= 0 : ¼Æ¦r>0 , Mid(PrintMonTh, Len(PrintMonTh)) <> "¤ë":³Ì«áªº¦r¤¸<>"¤ë"
- On Error GoTo ER '¿é¤Jªº¤ë¥÷¤u§@ªí¤£¦s¦b,¤U±ªºµ{¦¡½X·|¦³¿ù»~
- With Sheets("Á~¸ê³æ¦C¦L")
- Set Rng(1) = .Range("C4:C21") '²Ä¤@µ§¿é¤J¸ê®Æªº½d³ò
- .PageSetup.PrintArea = .Range("a4:k21").Address '¦L¦C½d³òªº³]©w
- End With
- With Sheets(PrintMonTh) ' . ¬°³oª«¥ó(¤u§@ªí)¤Uªºª«¥ó,¤èªk,ÄÝ©Ê
- i = 5
- ii = 0
- Do While .Cells(i, "A") <> "" '³oª«¥ó(¤u§@ªí)¤UªºAÄæ<>""
- If .Cells(i, "A") <> "ºÞ²z" Then
- Set Rng(2) = Rng(1).Offset(, ii * 4) 'ii * 4 : Rng(1)¦ì²¾ªºÄæ¼Æ,²¾¨ì¤U¤@µ§n¿é¤Jªº¦ì¸m
- Rng(2).Cells(1) = PrintMonTh '¤ë¥÷
- Rng(2).Cells(2) = .Cells(i, "B") '©m¦W
- Rng(2).Cells(3) = .Cells(i, "P") '¥»©^
- Rng(2).Cells(4) = .Cells(i, "Q") '¤é·s
- Rng(2).Cells(5) = .Cells(i, "C") '¤Ñ¼Æ(¥X¶Ô¤é¼Æ)
- Rng(2).Cells(6) = .Cells(i, "Q") * .Cells(i, "C")
- '¤pp (¤Ñ¼Æ*¤é·s)
- Rng(2).Cells(7) = .Cells(i, "R") '¤u§@¬z¶K
- Rng(2).Cells(8) = .Cells(i, "S") 'ÃÒ·Ó¶O
- Rng(2).Cells(9) = .Cells(i, "U") '¥ë¹¬z¶K
- Rng(2).Cells(10) = .Cells(i, "T") '¥[¯Z¶O
- Rng(2).Cells(11) = .Cells(i, "L") '¸`¼y¼úª÷
- Rng(2).Cells(12) = .Cells(i, "V") '½Ð°²¦©´Ú
- Rng(2).Cells(13) = .Cells(i, "W") '¿ð¨ì¦©´Ú
- Rng(2).Cells(14) = .Cells(i, "X") '³Ò«O¶O
- Rng(2).Cells(15) = .Cells(i, "T") '°·«O¶O
- Rng(2).Cells(16) = .Cells(i, "Z") '³Ò°hª÷
-
- Rng(2).Cells(18) = .Cells(i, "AB") '¹ê»âª÷ÃB
- If ii = 2 Then '¹F 3¤H¦¸
- Sheets("Á~¸ê³æ¦C¦L").PrintOut
- For ii = 0 To 2 '²M°£¸ê®Æ
- Rng(1).Offset(, ii * 4) = ""
- Next
- ii = 0 '¦¸¼Æ:Âk¹s
- Else
- ii = ii + 1
- End If
- End If
- i = i + 1
- Loop
- End With
- MsgBox "¦L¦C §¹²¦"
- Exit Sub
- ER:
- MsgBox "¨S¦³ " & IIf(PrintMonTh = "", "¿é¤J¤ë¥÷", PrintMonTh & " ¤u§@ªí")
- End Sub
½Æ»s¥N½X |
|