返回列表 上一主題 發帖

依列印份數自動產生流水號

回復 3# sping

只出現一次列印對話方塊
  1. Sub 列印申請書()
  2. Dim sh()
  3. Application.DisplayAlerts = False
  4. Sheets("申請書").Range("x24") = Sheets("輸入區").Range("b13")
  5. w5 = Application.InputBox("列印申請書多少份? ", Type:=1)
  6. If w5 < 1 Then
  7. MsgBox "未輸入正確之列印份數,無法列印申請書"
  8. Else
  9. With ws
  10.        For skb = 1 To w5
  11.        Sheets("申請書").Range("x24").Value = Sheets("申請書").Range("x24").Value + 1
  12.        Sheet2.Copy after:=Sheets(Sheets.Count)
  13.        ReDim Preserve sh(s)
  14.        sh(s) = ActiveSheet.Name
  15.        s = s + 1
  16.        Next skb
  17. End With
  18. End If
  19. Sheets(sh).PrintOut
  20. Sheets(sh).Delete
  21. Application.DisplayAlerts = True
  22. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 要批評別人時,先想想自己是否完美無缺。
返回列表 上一主題